mirror of
https://github.com/SinTan1729/chhoto-url
synced 2024-12-26 07:38:36 -06:00
41 lines
No EOL
1.5 KiB
YAML
41 lines
No EOL
1.5 KiB
YAML
# This file is a template, and might need editing before it works on your project.
|
|
docker-build-main:
|
|
# Official docker image, develop tag
|
|
image: docker:latest
|
|
stage: build
|
|
services:
|
|
- docker:dind
|
|
before_script:
|
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
script:
|
|
- docker pull "$CI_REGISTRY_IMAGE:develop-depsonly" || true
|
|
- docker build --cache-from "$CI_REGISTRY_IMAGE:develop-depsonly" --target build -t "$CI_REGISTRY_IMAGE:develop-depsonly" .
|
|
- docker push "$CI_REGISTRY_IMAGE:develop-depsonly"
|
|
- docker build -t "$CI_REGISTRY_IMAGE:develop" .
|
|
- docker push "$CI_REGISTRY_IMAGE:develop"
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH != "main"
|
|
when: never
|
|
- if: $CI_COMMIT_TAG == null
|
|
when: on_success
|
|
|
|
docker-build-tag:
|
|
# Official docker image, tagged release (also updates latest)
|
|
image: docker:latest
|
|
stage: build
|
|
services:
|
|
- docker:dind
|
|
before_script:
|
|
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
|
script:
|
|
- docker pull "$CI_REGISTRY_IMAGE:develop-depsonly" || true
|
|
- docker build --cache-from "$CI_REGISTRY_IMAGE:develop-depsonly" -t "$CI_REGISTRY_IMAGE:develop-depsonly"
|
|
- docker push "$CI_REGISTRY_IMAGE:develop-depsonly"
|
|
- docker build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" -t "$CI_REGISTRY_IMAGE" .
|
|
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"
|
|
- docker push "$CI_REGISTRY_IMAGE:latest"
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH != "main"
|
|
when: never
|
|
- if: $CI_COMMIT_TAG
|
|
when: on_success |