Last active
September 15, 2020 21:56
-
-
Save JayH5/b76c53bf4c48a670bf16182bc971de25 to your computer and use it in GitHub Desktop.
Example production Travis file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo: required | |
services: | |
- docker | |
env: | |
global: | |
- IMAGE_NAME=acme-corp/cake-service | |
- REGISTRY_USER=myrobot | |
# REGISTRY_PASS=... | |
- secret: "<something long>" | |
before_script: | |
- version="$(awk '$2 == "CAKE_SERVICE_VERSION" { print $3; exit }' Dockerfile)" | |
- docker pull "$IMAGE_NAME" || true | |
script: | |
- docker build --pull --cache-from "$IMAGE_NAME" --tag "$IMAGE_NAME" . | |
after_script: | |
- docker images | |
before_deploy: | |
- docker login -u "$REGISTRY_USER" -p "$REGISTRY_PASS" | |
- docker tag "$IMAGE_NAME" "${IMAGE_NAME}:latest" | |
- docker tag "$IMAGE_NAME" "${IMAGE_NAME}:${version}" | |
deploy: | |
provider: script | |
script: docker push "${IMAGE_NAME}:latest" && docker push "${IMAGE_NAME}:${version}" | |
on: | |
branch: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment