Skip to content

Commit 7d0789d

Browse files
Fix docker build (#406)
* touch manually * push separately again * don't need to remote update files
1 parent 4e5536c commit 7d0789d

4 files changed

Lines changed: 9 additions & 25 deletions

File tree

.github/workflows/run_tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,18 @@ jobs:
5353
python -c "import openproblems"
5454
5555
- name: Build Docker images
56-
if: "!startsWith(github.ref, 'refs/heads/main')"
5756
run: |
5857
cd workflow
5958
snakemake -j $(nproc) docker_build
6059
cd ..
6160
62-
- name: Build and push Docker images
61+
- name: Push Docker images
6362
if: "startsWith(github.ref, 'refs/heads/main')"
6463
env:
6564
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
6665
run: |
6766
cd workflow
68-
snakemake -j $(nproc) docker_build docker_push
67+
snakemake -j $(nproc) docker_push
6968
cd ..
7069
echo "CHANGED=`git diff --exit-code > /dev/null && echo false || echo true`" >> $GITHUB_ENV
7170

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,4 @@ nf-openproblems
148148
.idea
149149

150150
# snakemake
151-
.docker_build
152-
.docker_pull
153-
.docker_refresh
154151
.docker_update
155-
.docker_push

workflow/Snakefile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ rule refresh_docker_image:
3131
dockerfile = "{}/{{image}}/refresh.Dockerfile".format(tools.IMAGES_DIR),
3232
requirements = tools.docker_refresh_requirements,
3333
output:
34-
touch("{}/{{image}}/.docker_refresh".format(tools.IMAGES_DIR))
34+
temp(touch("{}/{{image}}/.docker_refresh".format(tools.IMAGES_DIR)))
3535
params:
3636
sourcedir = os.path.dirname(tools.SCRIPTS_DIR),
3737
user = "singlecellopenproblems",
@@ -67,14 +67,16 @@ rule update_docker_image:
6767
input:
6868
tools.docker_update_requirements
6969
output:
70-
touch("{}/{{image}}/.docker_update".format(tools.IMAGES_DIR))
70+
"{}/{{image}}/.docker_update".format(tools.IMAGES_DIR)
71+
shell:
72+
"touch {output}"
7173

7274
rule build_docker_image:
7375
input:
7476
dockerfile = "{}/{{image}}/Dockerfile".format(tools.IMAGES_DIR),
7577
requirements = tools.docker_build_requirements,
7678
output:
77-
touch("{}/{{image}}/.docker_build".format(tools.IMAGES_DIR))
79+
temp(touch("{}/{{image}}/.docker_build".format(tools.IMAGES_DIR)))
7880
params:
7981
sourcedir = os.path.dirname(tools.SCRIPTS_DIR),
8082
user = "singlecellopenproblems",
@@ -102,13 +104,13 @@ rule push_docker_image:
102104
build = "{}/{{image}}/.docker_update".format(tools.IMAGES_DIR),
103105
login = ".docker_login",
104106
output:
105-
touch("{}/{{image}}/.docker_push".format(tools.IMAGES_DIR))
107+
temp(touch("{}/{{image}}/.docker_push".format(tools.IMAGES_DIR)))
106108
shell:
107109
"docker push --quiet singlecellopenproblems/{wildcards.image}"
108110

109111
rule pull_docker_image:
110112
output:
111-
touch("{}/{{image}}/.docker_pull".format(tools.IMAGES_DIR))
113+
temp(touch("{}/{{image}}/.docker_pull".format(tools.IMAGES_DIR)))
112114
shell:
113115
"DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect singlecellopenproblems/{wildcards.image} > /dev/null && \
114116
docker pull --quiet singlecellopenproblems/{wildcards.image} || true"

workflow/snakemake_tools.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -390,16 +390,3 @@ def docker_command(wildcards, output):
390390
"""Get the Docker command to be run given a set of wildcards."""
391391
image = docker_image_name(wildcards)
392392
return DOCKER_EXEC.format(image=image)
393-
394-
395-
for image in _images(""):
396-
for filename in [
397-
".docker_push",
398-
".docker_pull",
399-
".docker_build",
400-
".docker_refresh",
401-
]:
402-
try:
403-
os.remove(os.path.join(image, filename))
404-
except FileNotFoundError:
405-
pass

0 commit comments

Comments
 (0)