Move docker login to stages where docker image is used

This commit is contained in:
2019-03-12 12:24:55 +01:00
parent ac6861c73d
commit 2efe8e2be0
+4 -1
View File
@@ -8,7 +8,6 @@ before_script:
- rm -rf /go/pkg
- ln -s ${CI_PROJECT_DIR}/_go/pkg /go/pkg
- ln -s ${CI_PROJECT_DIR}/_go/bin /go/bin
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
cache:
key: "$CI_COMMIT_REF_NAME"
@@ -57,6 +56,8 @@ package:
image: docker:stable
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
@@ -68,6 +69,8 @@ release:
image: docker:stable
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- docker push $CI_REGISTRY_IMAGE:latest