Add push stage

This commit is contained in:
Evan Richardson
2021-03-04 14:12:49 -08:00
parent 7b80ce48e1
commit 695c4b3655

View File

@@ -1,5 +1,6 @@
stages: stages:
- build - build
- push
before_script: before_script:
- docker version - docker version
@@ -19,9 +20,22 @@ build:
before_script: before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker login registry.evanrichardsonphotography.com - docker build --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker build -t registry.evanrichardsonphotography.com/erichardson/py-eagle-mqtt ./Docker/ - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push registry.evanrichardsonphotography.com/erichardson/py-eagle-mqtt #- docker login registry.evanrichardsonphotography.com
#- docker build -t registry.evanrichardsonphotography.com/erichardson/py-eagle-mqtt ./Docker/
#- docker push registry.evanrichardsonphotography.com/erichardson/py-eagle-mqtt
#- ls #- ls
#- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" ./Docker/ #- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" ./Docker/
#- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" #- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
push:
stage: push
variables:
GIT_STRATEGY: none
only:
- master
script:
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest