Update .gitlab-ci.yml file

This commit is contained in:
SinTan1729 2023-02-28 17:47:29 -06:00
parent 6b8ae8657f
commit e45ecd8eef

View File

@ -1,6 +1,6 @@
# This file is a template, and might need editing before it works on your project. # This file is a template, and might need editing before it works on your project.
docker-build-main: docker-build-main:
# Official docker image. # Official docker image, develop tag
image: docker:latest image: docker:latest
stage: build stage: build
services: services:
@ -8,13 +8,16 @@ docker-build-main:
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 build --pull -t "$CI_REGISTRY_IMAGE" . - docker build --pull -t "$CI_REGISTRY_IMAGE:develop" .
- docker push "$CI_REGISTRY_IMAGE" - docker push "$CI_REGISTRY_IMAGE:develop"
only: rules:
- main - if: $CI_COMMIT_BRANCH != "main"
when: never
- if: $CI_COMMIT_TAG == null
when: on_success
docker-build: docker-build-tag:
# Official docker image. # Official docker image, tagged release (also updates latest)
image: docker:latest image: docker:latest
stage: build stage: build
services: services:
@ -22,7 +25,10 @@ docker-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 build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" . - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -t "$CI_REGISTRY_IMAGE" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" - docker push --all-tags "$CI_REGISTRY_IMAGE"
except: rules:
- main - if: $CI_COMMIT_BRANCH != "main"
when: never
- if: $CI_COMMIT_TAG
when: on_success