Image is now deployed only on tag creation. Latest tag was added (better pour image usage)
34 lines
603 B
YAML
34 lines
603 B
YAML
image: docker:latest
|
|
|
|
# When using dind, it's wise to use the overlayfs driver for
|
|
# improved performance.
|
|
variables:
|
|
DOCKER_DRIVER: overlay
|
|
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
|
|
IMAGE_LATEST: $CI_REGISTRY_IMAGE:latest
|
|
|
|
services:
|
|
- docker:dind
|
|
|
|
stages:
|
|
- build
|
|
- deploy
|
|
|
|
before_script:
|
|
- docker info
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
|
|
build:
|
|
stage: build
|
|
script:
|
|
- docker build -t $IMAGE_TAG .
|
|
|
|
deploy:
|
|
stage: deploy
|
|
script:
|
|
- docker build -t $IMAGE_TAG -t $IMAGE_LATEST .
|
|
- docker push $CI_REGISTRY_IMAGE
|
|
only:
|
|
- tags
|
|
|