From 4f0cfebf854d26a1c84b91ba4521f9d30eff3dfa Mon Sep 17 00:00:00 2001 From: Daniel Cameron Date: Thu, 23 Dec 2021 14:54:15 +1100 Subject: [PATCH] #548 Initial attempt at docker CI --- .github/workflows/docker.yml | 40 +++++++++++++++++++++++++++++++++++ Dockerfile | 12 +++++------ scripts/dev/create_release.sh | 3 --- 3 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..4d049feb --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,40 @@ +name: docker-ci + +on: + push: + branches: + - master + - dev + pull_request: + branches: + - master + - dev + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + with: + submodules: 'recursive' + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: false + tags: gridss/gridss:latest \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 6b307dc6..928fd509 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,9 @@ ARG UBUNTU_VERSION=20.04 -# Use the closest mirror so apt-get doesnt take ages FROM ubuntu:$UBUNTU_VERSION AS gridss_base_closest_mirror +# Use the closest mirror so apt-get doesnt take ages RUN sed -i -e 's/http:\/\/archive\.ubuntu\.com\/ubuntu\//mirror:\/\/mirrors\.ubuntu\.com\/mirrors\.txt/' /etc/apt/sources.list -# compile GRIDSS C code + +# Set up a C build environment for gridsstools, samtools, and R packages FROM gridss_base_closest_mirror AS gridss_c_build_environment RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ libssl-dev \ @@ -12,7 +13,6 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ libbz2-dev \ liblzma-dev \ libdeflate-dev \ - libncurses5-dev \ build-essential \ autotools-dev \ autoconf \ @@ -22,10 +22,10 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ libomp-dev \ && rm -rf /var/lib/apt/lists/* +# compile gridsstools FROM gridss_c_build_environment AS gridss_builder_c RUN mkdir /opt/gridss/ ARG GRIDSS_VERSION -# compile gridsstools COPY src/main/c /opt/gridss/src/main/c COPY src/test/resources /opt/gridss/src/test/resources RUN cd /opt/gridss/src/main/c/gridsstools/htslib && \ @@ -33,6 +33,7 @@ RUN cd /opt/gridss/src/main/c/gridsstools/htslib && \ cd .. && \ autoreconf -i && ./configure && make -j 8 && \ cp gridsstools /opt/gridss/ + # compile GRIDSS Java code FROM maven:3.6.3-jdk-8 AS gridss_builder_java RUN mkdir /opt/gridss/ @@ -40,8 +41,7 @@ WORKDIR /opt/gridss/ # Download maven dependencies first so docker can cache them COPY pom.xml /opt/gridss/ COPY repo /opt/gridss/repo -#RUN mvn -Dmaven.artifact.threads=8 dependency:go-offline -# run all stages so all dependencies are +# run all stages so all dependencies are cached RUN mvn -Dmaven.artifact.threads=8 verify && rm -rf target # Build GRIDSS jar ARG GRIDSS_VERSION diff --git a/scripts/dev/create_release.sh b/scripts/dev/create_release.sh index 6623d71b..f1db8f25 100644 --- a/scripts/dev/create_release.sh +++ b/scripts/dev/create_release.sh @@ -28,7 +28,6 @@ mv src/main/c/gridsstools-src-$version.tar.gz release/ cp LICENSE release/ # https://bioconda.github.io/contributor/linting.html#gpl-requires-license-distributed docker build --build-arg GRIDSS_VERSION=$version --target gridss_export_build_artefacts --output type=local,dest=release . # --progress=plain docker build --build-arg GRIDSS_VERSION=$version --target gridss -t gridss/gridss:$version -t gridss/gridss:latest . -docker build --build-arg GRIDSS_VERSION=$version --target gridss_minimal -t gridss/gridss_minimal:$version -t gridss/gridss_minimal:latest . docker build --build-arg GRIDSS_VERSION=$version --target gridss -t gridss/virusbreakend:$version -t gridss/virusbreakend:latest . cd release chmod +x * @@ -36,8 +35,6 @@ chmod -x *.R *.jar tar czf gridss-$version.tar.gz * echo docker push gridss/gridss:$version echo docker push gridss/gridss:latest -echo docker push gridss/gridss_minimal:$version -echo docker push gridss/gridss_minimal:latest echo docker push gridss/virusbreakend:$version echo docker push gridss/virusbreakend:latest