2020-01-30 06:45:49 +00:00
|
|
|
stages:
|
2020-02-05 04:01:17 +00:00
|
|
|
- build docker image
|
|
|
|
- push docker hub
|
2020-01-30 06:45:49 +00:00
|
|
|
|
2020-02-05 04:01:17 +00:00
|
|
|
build:
|
|
|
|
stage: build docker image
|
|
|
|
image: docker:latest
|
2020-01-30 06:45:49 +00:00
|
|
|
script:
|
2020-02-05 04:01:17 +00:00
|
|
|
- docker info
|
|
|
|
- docker build --network br_docker --tag ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA} --tag ${CI_REGISTRY_IMAGE}:latest .
|
2020-01-30 06:45:49 +00:00
|
|
|
|
2020-02-05 04:01:17 +00:00
|
|
|
push:
|
|
|
|
stage: push docker hub
|
2020-01-30 06:45:49 +00:00
|
|
|
image: docker:latest
|
|
|
|
only:
|
|
|
|
- master
|
|
|
|
script:
|
2020-02-05 04:01:17 +00:00
|
|
|
- echo ${REGISTRY_PASSWORD} | docker login -u ${CI_REGISTRY_USER} --password-stdin ${CI_REGISTRY}
|
2020-01-30 06:45:49 +00:00
|
|
|
- docker push ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHORT_SHA}
|
|
|
|
- docker push ${CI_REGISTRY_IMAGE}:latest
|