Browse Source

Merge pull request #184 from CatalystCode/enhancement/tag-docker-image-with-build-number

Enhancement/Publish each master to Docker Hub
pull/200/head
Hiroki Nakayama 5 years ago
committed by GitHub
parent
commit
5f5eae1a8f
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions
  1. 8
      .travis.yml
  2. 6
      tools/cd.sh

8
.travis.yml

@ -8,7 +8,11 @@ script:
deploy:
- provider: script
script: tools/cd.sh
script: tools/cd.sh travis-${TRAVIS_BUILD_NUMBER}
on:
branch: master
- provider: script
script: tools/cd.sh ${TRAVIS_TAG}
on:
repo: chakki-works/doccano
tags: true

6
tools/cd.sh

@ -2,14 +2,14 @@
if [[ -z "${DOCKER_USERNAME}" ]]; then echo "Missing DOCKER_USERNAME environment variable" >&2; exit 1; fi
if [[ -z "${DOCKER_PASSWORD}" ]]; then echo "Missing DOCKER_PASSWORD environment variable" >&2; exit 1; fi
if [[ -z "${TRAVIS_TAG}" ]]; then echo "Missing TRAVIS_TAG environment variable" >&2; exit 1; fi
if [[ -z "$1" ]]; then echo "Usage: $0 <tag>" >&2; exit 1; fi
set -o errexit
docker build -t "${DOCKER_USERNAME}/doccano:latest" .
docker build -t "${DOCKER_USERNAME}/doccano:${TRAVIS_TAG}" .
docker build -t "${DOCKER_USERNAME}/doccano:$1" .
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
docker push "${DOCKER_USERNAME}/doccano:latest"
docker push "${DOCKER_USERNAME}/doccano:${TRAVIS_TAG}"
docker push "${DOCKER_USERNAME}/doccano:$1"
Loading…
Cancel
Save