build(docker): add build for tagged versions on main, beta and alpha

This commit is contained in:
Romain de Laage 2022-08-23 09:50:00 +00:00 committed by Yassine Doghri
parent c4a07c29f1
commit 029804b9f8
3 changed files with 45 additions and 0 deletions

View File

@ -131,6 +131,10 @@ release:
dependencies:
- php-dependencies
- js-dependencies
artifacts:
paths:
- castopod
- CP_VERSION.env
only:
- main
- beta
@ -163,5 +167,8 @@ docker:
only:
refs:
- develop
- main
- beta
- alpha
variables:
- $CI_PROJECT_NAMESPACE == "adaures"

View File

@ -18,3 +18,38 @@ docker-build-rolling:
only:
refs:
- develop
docker-build-main-release:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- cp ${DOCKER_HUB_CONFIG} /kaniko/.docker/config.json
- export CP_VERSION=(cat CP_VERSION.env)
- /kaniko/executor --context . --dockerfile docker/production/web-server/Dockerfile --destination ${DOCKER_IMAGE_WEB_SERVER}:${CP_VERSION} --destination ${DOCKER_IMAGE_WEB_SERVER}:latest
- /kaniko/executor --context . --dockerfile docker/production/app/Dockerfile --destination ${DOCKER_IMAGE_APP}:${CP_VERSION} --destination ${DOCKER_IMAGE_APP}:latest
needs:
- pipeline: $PARENT_PIPELINE_ID
job: release
only:
refs:
- main
docker-build-alpha-beta-release:
stage: build
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- cp ${DOCKER_HUB_CONFIG} /kaniko/.docker/config.json
- export CP_VERSION=(cat CP_VERSION.env)
- /kaniko/executor --context . --dockerfile docker/production/web-server/Dockerfile --destination ${DOCKER_IMAGE_WEB_SERVER}:${CP_VERSION}
- /kaniko/executor --context . --dockerfile docker/production/app/Dockerfile --destination ${DOCKER_IMAGE_APP}:${CP_VERSION}
needs:
- pipeline: $PARENT_PIPELINE_ID
job: release
only:
refs:
- alpha
- beta

View File

@ -11,6 +11,9 @@ echo "$( jq '.version = "'$COMPOSER_VERSION'"' composer.json )" > composer.json
# replace CP_VERSION constant in app/config/constants
sed -i "s/^defined('CP_VERSION').*/defined('CP_VERSION') || define('CP_VERSION', '$VERSION');/" ./app/Config/Constants.php
# fill CP_VERSION.env for docker build
echo "$VERSION" > ./CP_VERSION.env
# install wget to download archives
apt-get install wget