Skip to content

Commit 338f847

Browse files
committed
MAINT: Push docker image to docker hub
1 parent 071e3e2 commit 338f847

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

.circleci/config.yml

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ jobs:
372372
INSTALLED=$( python3 -c 'import niworkflows; print(niworkflows.__version__)' )
373373
test "${CIRCLE_TAG:-$THISVERSION}" == "$INSTALLED"
374374
375-
deploy:
375+
deploy_pypi:
376376
machine:
377377
image: circleci/classic:201808-01
378378
working_directory: /tmp/src/niworkflows
@@ -402,6 +402,40 @@ jobs:
402402
command: |
403403
python3 -m twine upload dist/*
404404
405+
deploy_docker:
406+
machine:
407+
image: circleci/classic:201808-01
408+
working_directory: /tmp/src/
409+
steps:
410+
- restore_cache:
411+
keys:
412+
- build-v1-{{ .Branch }}-{{ epoch }}
413+
- build-v1-{{ .Branch }}-
414+
- build-v1-master-
415+
- build-v1-
416+
paths:
417+
- /tmp/docker
418+
- run:
419+
name: Set-up a Docker registry
420+
command: |
421+
docker run -d -p 5000:5000 --restart=always --name=registry \
422+
-v /tmp/docker:/var/lib/registry registry:2
423+
- run:
424+
name: Pull images from local registry
425+
command: |
426+
docker pull localhost:5000/niworkflows
427+
docker tag localhost:5000/niworkflows nipreps/niworkflows:latest
428+
- run:
429+
name: Deploy to Docker Hub
430+
no_output_timeout: 40m
431+
command: |
432+
if [[ -n "$DOCKER_PASS" ]]; then
433+
docker login -u $DOCKER_USER -p $DOCKER_PASS
434+
docker push nipreps/niworkflows:latest
435+
docker tag nipreps/niworkflows nipreps/niworkflows:$CIRCLE_TAG
436+
docker push nipreps/niworkflows:$CIRCLE_TAG
437+
fi
438+
405439
build_docs:
406440
docker:
407441
- image: python:3.7.4
@@ -537,7 +571,7 @@ workflows:
537571
tags:
538572
ignore: /.*/
539573

540-
- deploy:
574+
- deploy_pypi:
541575
requires:
542576
- test_pytest
543577
- test_package
@@ -548,6 +582,15 @@ workflows:
548582
tags:
549583
only: /.*/
550584

585+
- deploy_docker:
586+
requires:
587+
- deploy_pypi
588+
filters:
589+
branches:
590+
ignore: /.*/
591+
tags:
592+
only: /.*/
593+
551594
- build_docs:
552595
filters:
553596
branches:
@@ -571,7 +614,7 @@ workflows:
571614

572615
- deploy_docs_tag:
573616
requires:
574-
- deploy
617+
- deploy_docker
575618
filters:
576619
branches:
577620
ignore: /.*/

0 commit comments

Comments
 (0)