From 029804b9f8dc41e89f077c3cb07e38d11083b11d Mon Sep 17 00:00:00 2001 From: Romain de Laage <romain.delaage@rdelaage.ovh> Date: Tue, 23 Aug 2022 09:50:00 +0000 Subject: [PATCH] build(docker): add build for tagged versions on main, beta and alpha --- .gitlab-ci.yml | 7 +++++++ docker/production/.gitlab-ci.yml | 35 ++++++++++++++++++++++++++++++++ scripts/bundle.sh | 3 +++ 3 files changed, 45 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57a3d06967..d17fbda3ff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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" diff --git a/docker/production/.gitlab-ci.yml b/docker/production/.gitlab-ci.yml index 5c9e8b22e3..8297344e06 100644 --- a/docker/production/.gitlab-ci.yml +++ b/docker/production/.gitlab-ci.yml @@ -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 diff --git a/scripts/bundle.sh b/scripts/bundle.sh index baf9a84f73..95e31c485f 100644 --- a/scripts/bundle.sh +++ b/scripts/bundle.sh @@ -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 -- GitLab