diff options
author | Evan Read <eread@gitlab.com> | 2019-04-09 15:54:54 +1000 |
---|---|---|
committer | Evan Read <eread@gitlab.com> | 2019-04-09 15:56:44 +1000 |
commit | 2570b2510f0b5df97ea6cf9173ae1d879532941d (patch) | |
tree | ab8aa22c2a4aab641faa09d0b787df9c675ae183 | |
parent | 80d452ef28b605f3a9e172239e121e2ef66d039f (diff) | |
download | gitlab-ce-docs/update-registry-user.tar.gz |
Even more predefined variablesdocs/update-registry-user
-rw-r--r-- | doc/ci/docker/using_docker_build.md | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md index 9c39d645f48..5222cc45bc4 100644 --- a/doc/ci/docker/using_docker_build.md +++ b/doc/ci/docker/using_docker_build.md @@ -303,7 +303,6 @@ services: - docker:dind variables: - CONTAINER_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH DOCKER_HOST: tcp://docker:2375 DOCKER_DRIVER: overlay2 @@ -313,10 +312,10 @@ before_script: build: stage: build script: - - docker pull $CONTAINER_IMAGE:latest || true - - docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_SHA --tag $CONTAINER_IMAGE:latest . - - docker push $CONTAINER_IMAGE:$CI_COMMIT_SHA - - docker push $CONTAINER_IMAGE:latest + - docker pull $CI_REGISTRY_IMAGE:latest || true + - docker build --cache-from $CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest . + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA + - docker push $CI_REGISTRY_IMAGE:latest ``` The steps in the `script` section for the `build` stage can be summed up to: @@ -324,7 +323,7 @@ The steps in the `script` section for the `build` stage can be summed up to: 1. The first command tries to pull the image from the registry so that it can be used as a cache for the `docker build` command. 1. The second command builds a Docker image using the pulled image as a - cache (notice the `--cache-from $CONTAINER_IMAGE:latest` argument) if + cache (notice the `--cache-from $CI_REGISTRY_IMAGE:latest` argument) if available, and tags it. 1. The last two commands push the tagged Docker images to the container registry so that they may also be used as cache for subsequent builds. |