Skip to content
Snippets Groups Projects
Commit 91f32cea authored by E. Madison Bray's avatar E. Madison Bray
Browse files

[ci] tag Docker images built from the master branch, and use them as a

starting point for docker builds on MRs/branches, which should speed
up those builds in most cases
parent 3f21e9a9
No related branches found
No related tags found
1 merge request!3[ci] tag Docker images built from the master branch
Checking pipeline status
This commit is part of merge request !3. Comments created here will be created in the context of that merge request.
stages: stages:
- "docker" - "docker"
- "test" - "test"
- "deploy"
- "cleanup" - "cleanup"
variables: variables:
...@@ -29,7 +30,9 @@ docker:build: ...@@ -29,7 +30,9 @@ docker:build:
before_script: before_script:
- "docker info" - "docker info"
script: script:
- "docker build --tag ${IMAGE_REGISTRY}:${CI_COMMIT_SHA} ." - >
docker build --cache-from ${IMAGE_REGISTRY}:master
--tag ${IMAGE_REGISTRY}:${CI_COMMIT_SHA} .
.test: &test .test: &test
...@@ -111,9 +114,26 @@ test:docker: ...@@ -111,9 +114,26 @@ test:docker:
artifacts: {} artifacts: {}
.docker:tag: &docker_tag
stage: "deploy"
image: "docker:${DOCKER_VERSION}"
before_script:
- docker info
script:
- docker tag ${IMAGE_REGISTRY}:${CI_COMMIT_SHA} ${REGISTRY_IMAGE}:${TAG_NAME}
deploy:docker-master:
<<: *docker_tag
only:
- "master"
variables:
TAG_NAME: "master"
cleanup:docker: cleanup:docker:
stage: "cleanup" stage: "cleanup"
image: "docker:18" image: "docker:${DOCKER_VERSION}"
only: *only only: *only
when: "always" when: "always"
before_script: before_script:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment