Refactor out authentication job from build job
This commit is contained in:
parent
8ee09be3d0
commit
4b86de69da
@ -1,25 +1,31 @@
|
||||
stages:
|
||||
- auth
|
||||
- build
|
||||
- publish
|
||||
- deploy
|
||||
|
||||
auth-job:
|
||||
stage: auth
|
||||
image: docker:stable
|
||||
script:
|
||||
- docker login --username "$REGISTRY_USER" --password "$REGISTRY_PASSWORD" "$REGISTRY_BASE_URL"
|
||||
artifacts:
|
||||
paths:
|
||||
- ~/.docker/
|
||||
|
||||
build-job:
|
||||
stage: build
|
||||
image: docker:stable
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
- docker login --username "$REGISTRY_USER" --password "$REGISTRY_PASSWORD" "$REGISTRY_BASE_URL"
|
||||
- docker -H unix:///var/run/docker.sock image build -t "$REGISTRY_BASE_URL/$DOCKER_IMAGE_NAME:$CI_COMMIT_SHORT_SHA" ./
|
||||
artifacts:
|
||||
paths:
|
||||
- ~/.docker/
|
||||
|
||||
publish-job:
|
||||
stage: publish
|
||||
image: docker:stable
|
||||
dependencies:
|
||||
- build-job
|
||||
- auth-job
|
||||
tags:
|
||||
- docker
|
||||
script:
|
||||
@ -30,7 +36,7 @@ deploy-job:
|
||||
when: manual
|
||||
image: google/cloud-sdk
|
||||
dependencies:
|
||||
- build-job
|
||||
- auth-job
|
||||
script:
|
||||
- export KUBECONFIG="$KUBE_AUTH"
|
||||
- cp "$ENV_PRODUCTION" "./build/.env.production"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user