From 3b29cd5c3affea163a7c0352b6a2a45e739cbe76 Mon Sep 17 00:00:00 2001 From: markoburcul Date: Wed, 1 Jul 2026 10:34:38 +0200 Subject: [PATCH] ci: add docker image build of cms Referenced issue: * https://github.com/status-im/infra-sites/issues/135 Signed-off-by: markoburcul --- Jenkinsfile | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 321e2c8435..0618246cc4 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,7 +8,9 @@ pipeline { label 'linuxcontainer' image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0' args '--volume=/nix:/nix ' + - '--volume=/etc/nix:/etc/nix ' + '--volume=/etc/nix:/etc/nix ' + + '--volume=/var/run/docker.sock:/var/run/docker.sock ' + + '--user jenkins' } } @@ -31,6 +33,26 @@ pipeline { defaultValue: '2ec82f0e-5f3c-45d2-ba38-223ceb5eee42', description: 'Public hCaptcha site key for the apps/web hCaptcha widget.', ) + string( + name: 'DOCKER_CRED', + description: 'Name of Docker Registry credential.', + defaultValue: params.DOCKER_CRED ?: 'harbor-logos-web-robot', + ) + string( + name: 'DOCKER_REGISTRY_URL', + description: 'URL of the Docker Registry', + defaultValue: params.DOCKER_REGISTRY_URL ?: 'https://harbor.status.im', + ) + string( + name: 'IMAGE_TAG', + description: 'Image tag', + defaultValue: params.IMAGE_TAG ?: deployBranch(), + ) + string( + name: 'IMAGE_NAME', + description: 'Name of the Docker image', + defaultValue: 'logos-web/logos-cms', + ) } stages { @@ -57,7 +79,7 @@ pipeline { } } - stage('Publish') { + stage('Publish web app') { steps { sshagent(credentials: ['status-im-auto-ssh']) { script { @@ -72,6 +94,31 @@ pipeline { } } } + + stage('Build CMS docker image') { + steps { + script { + image = docker.build( + "${params.IMAGE_NAME}:${params.IMAGE_TAG}", + "--build-arg NEXT_PUBLIC_SERVER_URL=https://${cmsDomain()} " + + "--build-arg NEXT_PUBLIC_WEB_URL=https://${deployDomain()} " + + "-f ./apps/cms/Dockerfile ." + ) + } + } + } + + stage('Push CMS docker image'){ + steps { + script { + withDockerRegistry([ + credentialsId: params.DOCKER_CRED, url: params.DOCKER_REGISTRY_URL + ]) { + image.push() + } + } + } + } } post { cleanup { cleanWs() } @@ -82,3 +129,4 @@ def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' } def deployDomain() { isMasterBranch() ? 'logos.co' : 'dev.logos.co' } def apiMode() { isMasterBranch() ? 'production' : 'staging' } def civiCrmUrl() { isMasterBranch() ? 'https://logos-web-civi.vercel.app' : 'https://logos-web-civi-git-develop-status-im-web.vercel.app/' } +def cmsDomain() { isMasterBranch() ? 'cms.logos.co' : 'dev-cms.logos.co' }