November 2019
Intermediate to advanced
408 pages
9h 56m
English
It is possible to push every single built image to the registry, identified by its Git SHA. This can be useful when work in progress can be shared for demo purposes, tests, and so on.
To do so, we need to create an environment variable with the Git SHA in the before_install section:
before_install: ... - export GIT_SHA=`git rev-parse --short HEAD` - echo "Building commit $GIT_SHA"
The push section then adds the tag and push of the image:
- stage: push script: - cd Chapter04 - docker-compose build server - docker tag thoughts_server:latest <registry>/thoughts-backend:$GIT_SHA - docker push <registry>/thoughts-backend:$GIT_SHA - docker tag thoughts_server:latest <registry>/thoughts-backend:$TRAVIS_BRANCH
As ...
Read now
Unlock full access