From 3521cf207fd10e5b541be58d6ef3119aeb3198ed Mon Sep 17 00:00:00 2001 From: zkhan12 Date: Wed, 15 Apr 2020 08:47:24 -0500 Subject: [PATCH 1/2] automate travis push to docker --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 8485448..100fda1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,8 @@ services: before_install: - docker build -t hbclab/accel-bids -f Dockerfile_exec . + - echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin + - docker push hbclab/accel-bids:latest script: - docker run --entrypoint /bin/bash hbclab/accel-bids -c ". activate accel; pytest /home/coder/projects" From 74edd08c21aaf68742012921aaa2a3e633ea0566 Mon Sep 17 00:00:00 2001 From: zkhan12 Date: Wed, 15 Apr 2020 09:56:19 -0500 Subject: [PATCH 2/2] add docker push instructions --- .travis.yml | 8 ++++++-- docker_push.sh | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 docker_push.sh diff --git a/.travis.yml b/.travis.yml index 100fda1..69f23e2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,9 +5,13 @@ services: before_install: - docker build -t hbclab/accel-bids -f Dockerfile_exec . - - echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin - - docker push hbclab/accel-bids:latest script: - docker run --entrypoint /bin/bash hbclab/accel-bids -c ". activate accel; pytest /home/coder/projects" +deploy: + provider: script + script: bash docker_push.sh + on: + branch: master + tags: true diff --git a/docker_push.sh b/docker_push.sh new file mode 100644 index 0000000..cd0c98b --- /dev/null +++ b/docker_push.sh @@ -0,0 +1,9 @@ +echo "$DOCKER_PASS" | docker login --username "$DOCKER_USERNAME" --password-stdin +# if tag is defined +if [[ ! -z "$TRAVIS_TAG"]]; then + docker push hbclab/accel-bids:$TRAVIS_TAG +# if the build is on the master branch +elif [[ "$TRAVIS_BRANCH" == "master" ]]; then + docker push hbclab/accel-bids:unstable +else + echo "This build is not on the master branch or a tagged release"