generated from CCBR/CCBR_NextflowTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: set up gh actions to build & push docker containers
towards #1
- Loading branch information
1 parent
fd31834
commit d42560d
Showing
9 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<image_dir>\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/[email protected] | ||
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'] }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Container for bagel processes in CRUISE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dockerhub_namespace: kellysovacool | ||
image_name: bagel | ||
version: test | ||
container: "$(dockerhub_namespace)/$(image_name):$(version)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# drugz | ||
|
||
Container for drugz processes in CRUISE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
dockerhub_namespace: kellysovacool | ||
image_name: drugz | ||
version: test | ||
container: "$(dockerhub_namespace)/$(image_name):$(version)" |
Empty file.