POSTGRES_PASSWORD: postgres
DB_HOST: postgres
MIX_ENV: test
- DOCKER_DRIVER: overlay2
- DOCKER_HOST: unix:///var/run/docker.sock
- DOCKER_IMAGE: $CI_REGISTRY_IMAGE:latest
- DOCKER_IMAGE_SHA: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
cache: &global_cache_policy
key: ${CI_COMMIT_REF_SLUG}
docker:
stage: docker
image: docker:latest
- tags:
- - dind
+ cache: {}
+ variables: &docker-variables
+ DOCKER_DRIVER: overlay2
+ DOCKER_HOST: unix:///var/run/docker.sock
+ IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
+ IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
+ IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
+ IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
before_script: &before-docker
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
- export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
script:
- - docker pull $DOCKER_IMAGE || true
- - docker build --cache-from $DOCKER_IMAGE --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $DOCKER_IMAGE_SHA -t $DOCKER_IMAGE .
- - docker push $DOCKER_IMAGE_SHA
- - docker push $DOCKER_IMAGE
+ - docker pull $IMAGE_TAG_SLUG || true
+ - docker build --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST .
+ - docker push $IMAGE_TAG
+ - docker push $IMAGE_TAG_SLUG
+ - docker push $IMAGE_TAG_LATEST
+ tags:
+ - dind
only:
- develop
+ - features/docker-updates
+
+docker-stable:
+ stage: docker
+ image: docker:latest
+ cache: {}
+ variables: *docker-variables
+ before_script: *before-docker
+ script:
+ - docker pull $IMAGE_TAG_SLUG || true
+ - docker build --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST_STABLE .
+ - docker push $IMAGE_TAG
+ - docker push $IMAGE_TAG_SLUG
+ - docker push $IMAGE_TAG_LATEST_STABLE
+ tags:
+ - dind
+ only:
+ - stable