From 8a812c61fe08fe9106b392a6f20e76ccd5b6ebb8 Mon Sep 17 00:00:00 2001 From: Valentin Zickner Date: Mon, 13 Dec 2021 20:59:05 +0100 Subject: [PATCH] implement docker build on tags Co-authored-by: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> --- .travis.yml | 31 +++++++++++++++++++++++++------ publish-docker-image.sh | 5 +++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100755 publish-docker-image.sh diff --git a/.travis.yml b/.travis.yml index 57b8bdfe4..743e9308d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,9 +3,28 @@ git: depth: false node_js: - 14 -before_script: - - yarn -script: - - yarn format:check - - yarn test - - yarn build:all + +services: + - docker + +cache: yarn + +if: (type = pull_request) OR (tag IS present) + +jobs: + include: + - stage: download dependencies + if: type = pull_request + script: yarn --frozen-lockfile + - stage: check formatting + if: type = pull_request + script: yarn format:check + - stage: execute tests + if: type = pull_request + script: yarn test + - stage: build + if: type = pull_request + script: yarn build:all + - stage: build and push docker images + if: tag IS present + script: ./publish-docker-image.sh diff --git a/publish-docker-image.sh b/publish-docker-image.sh new file mode 100755 index 000000000..310ffb49b --- /dev/null +++ b/publish-docker-image.sh @@ -0,0 +1,5 @@ +set -xe +echo "$DOCKER_HUB_ACCESS_TOKEN" | docker login -u "$DOCKER_HUB_USERNAME" --password-stdin + +docker build -t ghostfolio/ghostfolio:$TRAVIS_TAG . +docker push ghostfolio/ghostfolio:$TRAVIS_TAG