diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..6eabdcb --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,57 @@ +name: docker + +on: + push: + paths: + - .github/workflows/docker.yml + - "docker/**" + workflow_dispatch: + +jobs: + generate-matrix: + runs-on: ubuntu-latest + outputs: + matrix-metadata: ${{ steps.metadata.outputs.matrix }} + steps: + - uses: hellofresh/action-changed-files@v3 + id: metadata + with: + pattern: docker/(?P\w+)/.* + default-patterns: | + meta.yml + Dockerfile + + update-docker: + needs: [generate-matrix] + strategy: + matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix-metadata) }} + if: ${{ fromJson(needs.generate-matrix.outputs.matrix-metadata).include[0] }} # skip if the matrix is empty! + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pietrobolcato/action-read-yaml@1.0.0 + id: metadata + with: + config: ${{ github.workspace }}/docker/${{ matrix.image_dir }}/meta.yml + - name: Get date + id: date + run: | + echo "DATE=$(date +"%Y-%m-%d")" >> $GITHUB_OUTPUT + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v4 + # only try building & pushing the container if parsing the metadata worked + if: ${{ steps.metadata.outputs['container'] != '' }} + with: + context: docker/${{ matrix.image_dir }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.metadata.outputs['container'] }} + build-args: | + BUILD_DATE=${{ steps.date.outputs.DATE }} + BUILD_TAG=${{ steps.metadata.outputs['version'] }} + REPONAME=${{ steps.metadata.outputs['image_name'] }} diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..8f06d03 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,4 @@ +# Containers for CRUISE + +Dockerfiles to create containers for processes in this nextflow workflow. +These containers are built and pushed to dockerhub automatically when files in this directory change. diff --git a/docker/bagel/Dockerfile b/docker/bagel/Dockerfile new file mode 100644 index 0000000..c4abb1f --- /dev/null +++ b/docker/bagel/Dockerfile @@ -0,0 +1,30 @@ +FROM nciccbr/ccbr_ubuntu_base_20.04:v5 + +# build time variables +ARG BUILD_DATE="000000" +ENV BUILD_DATE=${BUILD_DATE} +ARG BUILD_TAG="000000" +ENV BUILD_TAG=${BUILD_TAG} +ARG REPONAME="000000" +ENV REPONAME=${REPONAME} + +# download bagel scripts and install dependencies +RUN python3 -m pip install --upgrade pip +RUN pip3 install click numpy scipy scikit-learn +ADD https://github.com/hart-lab/bagel/archive/refs/tags/v2.0-115.tar.gz /opt2 +WORKDIR /opt2 +RUN tar -xzvf v2.0-115.tar.gz && rm -f v2.0-115.tar.gz +ENV PATH="${PATH}:/opt2/bagel-2.0-115" + +# cleanup etc +# Save Dockerfile in the docker +COPY Dockerfile /opt2/Dockerfile_${REPONAME}.${BUILD_TAG} +RUN chmod a+r /opt2/Dockerfile_${REPONAME}.${BUILD_TAG} +#COPY argparse.bash /opt2 +RUN chmod -R a+rx /opt2/argparse.bash +ENV PATH="/opt2/:$PATH" +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + apt-get autoclean && \ + apt-get autoremove -y && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ +WORKDIR /data2 diff --git a/docker/bagel/README.md b/docker/bagel/README.md new file mode 100644 index 0000000..0c5cb74 --- /dev/null +++ b/docker/bagel/README.md @@ -0,0 +1 @@ +# Container for bagel processes in CRUISE diff --git a/docker/bagel/meta.yml b/docker/bagel/meta.yml new file mode 100644 index 0000000..75269f5 --- /dev/null +++ b/docker/bagel/meta.yml @@ -0,0 +1,4 @@ +dockerhub_namespace: kellysovacool +image_name: bagel +version: test +container: "$(dockerhub_namespace)/$(image_name):$(version)" diff --git a/docker/drugz/Dockerfile b/docker/drugz/Dockerfile new file mode 100644 index 0000000..35ee09f --- /dev/null +++ b/docker/drugz/Dockerfile @@ -0,0 +1,31 @@ +FROM nciccbr/ccbr_ubuntu_base_20.04:v5 + +# build time variables +ARG BUILD_DATE="000000" +ENV BUILD_DATE=${BUILD_DATE} +ARG BUILD_TAG="000000" +ENV BUILD_TAG=${BUILD_TAG} +ARG REPONAME="000000" +ENV REPONAME=${REPONAME} + +# download drugz script and install dependencies +RUN python3 -m pip install --upgrade pip +RUN pip3 install six numpy pandas scipy argparse +ADD https://github.com/hart-lab/drugz/archive/refs/heads/master.zip /opt2 +WORKDIR /opt2 +RUN ls +RUN unzip master.zip && rm -f master.zip +ENV PATH="${PATH}:/opt2/drugz-master" + +# cleanup etc +# Save Dockerfile in the docker +COPY Dockerfile /opt2/Dockerfile_${REPONAME}.${BUILD_TAG} +RUN chmod a+r /opt2/Dockerfile_${REPONAME}.${BUILD_TAG} +#COPY argparse.bash /opt2 +RUN chmod -R a+rx /opt2/argparse.bash +ENV PATH="/opt2/:$PATH" +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \ + apt-get autoclean && \ + apt-get autoremove -y && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ +WORKDIR /data2 diff --git a/docker/drugz/README.md b/docker/drugz/README.md new file mode 100644 index 0000000..0152b9a --- /dev/null +++ b/docker/drugz/README.md @@ -0,0 +1,3 @@ +# drugz + +Container for drugz processes in CRUISE diff --git a/docker/drugz/meta.yml b/docker/drugz/meta.yml new file mode 100644 index 0000000..970d7b8 --- /dev/null +++ b/docker/drugz/meta.yml @@ -0,0 +1,4 @@ +dockerhub_namespace: kellysovacool +image_name: drugz +version: test +container: "$(dockerhub_namespace)/$(image_name):$(version)" diff --git a/docker/mageck/Dockerfile b/docker/mageck/Dockerfile new file mode 100644 index 0000000..e69de29