feat: Add docker-multistage yml

This commit is contained in:
Vincent BRIDIER 2024-10-23 12:20:19 +00:00
parent a42eff5580
commit 35a30ce9af

View file

@ -0,0 +1,50 @@
.docker-build:
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.23.2-debug
entrypoint: [""]
script:
- /kaniko/executor
--context "${CI_PROJECT_DIR}"
--build-arg "GITLAB_USER=${CI_DEPLOY_USER}"
--build-arg "GITLAB_PASSWORD=${CI_DEPLOY_PASSWORD}"
--dockerfile "${CI_PROJECT_DIR}/Dockerfile"
--destination "${IMAGE_TAG}"
allow_failure: false
dependencies:
- composer-security
- npm-security
needs:
- job: composer-security
optional: true
- job: npm-security
optional: true
docker-build:staging:
extends: .docker-build
variables:
IMAGE_TAG: "${CI_REGISTRY_IMAGE}:s-${CI_COMMIT_SHA}"
rules:
- if: $CI_COMMIT_BRANCH == "trunk"
when: manual
allow_failure: true
docker-build:latest:
extends: .docker-build
variables:
IMAGE_TAG: "${CI_REGISTRY_IMAGE}:p-${CI_COMMIT_SHA}"
rules:
- if: $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_BRANCH == "master"
when: manual
allow_failure: true
docker-build:release:
extends: .docker-build
variables:
IMAGE_TAG: "${CI_REGISTRY_IMAGE}:${CI_COMMIT_TAG}"
rules:
- if: $CI_COMMIT_TAG != null
when: manual
allow_failure: true