Split Docker image build and deployment.
Image is now deployed only on tag creation. Latest tag was added (better pour image usage)
This commit is contained in:
parent
361f873963
commit
be59881974
@ -3,12 +3,17 @@ image: docker:latest
|
|||||||
# When using dind, it's wise to use the overlayfs driver for
|
# When using dind, it's wise to use the overlayfs driver for
|
||||||
# improved performance.
|
# improved performance.
|
||||||
variables:
|
variables:
|
||||||
DOCKER_DRIVER: overlay
|
DOCKER_DRIVER: overlay
|
||||||
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
||||||
|
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker:dind
|
- docker:dind
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- deploy
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- docker info
|
- docker info
|
||||||
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
||||||
@ -17,4 +22,12 @@ build:
|
|||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- docker build -t $IMAGE_TAG .
|
- docker build -t $IMAGE_TAG .
|
||||||
- docker push $IMAGE_TAG
|
|
||||||
|
deploy:
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- docker build -t $IMAGE_TAG -t $IMAGE_LATEST .
|
||||||
|
- docker push $CI_REGISTRY_IMAGE
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user