From 7faf379037590eb4d2464f12325514b272aef8a8 Mon Sep 17 00:00:00 2001 From: Kieren Evans Date: Fri, 6 Oct 2023 23:17:33 +0300 Subject: [PATCH 1/2] Build in Jenkins --- Jenkinsfile | 50 ++++++++++++++++++++++++++++++++++++++++++++++ docker-bake.hcl | 17 ++++++++++++++++ docker-compose.yml | 6 ------ 3 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 Jenkinsfile create mode 100644 docker-bake.hcl delete mode 100644 docker-compose.yml diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..4a46b83 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,50 @@ +pipeline { + agent { + label 'linux-amd64' + } + options { + buildDiscarder(logRotator(daysToKeepStr: '30')) + } + triggers { cron(env.BRANCH_NAME ==~ /^main$/ ? 'H H(0-6) 1 * *' : '') } + environment { + BUILDKIT_PROGRESS = 'plain' + } + stages { + stage('Setup') { + steps { + script { + env.CONTEXT = sh(script: 'docker buildx create', returnStdout: true).trim() + } + } + } + stage('Build') { + steps { + sh 'docker buildx bake --builder "${CONTEXT}"' + } + } + stage('Publish') { + environment { + DOCKER_REGISTRY_CREDS = credentials('docker-registry-credentials') + DOCKER_REGISTRY = 'quay.io' + } + when { + branch 'main' + } + steps { + sh 'echo "$DOCKER_REGISTRY_CREDS_PSW" | docker login --username "$DOCKER_REGISTRY_CREDS_USR" --password-stdin "$DOCKER_REGISTRY"' + sh 'docker buildx bake --builder "${CONTEXT}" --push' + } + post { + always { + sh 'docker logout "$DOCKER_REGISTRY"' + } + } + } + } + post { + always { + sh 'docker buildx rm "${CONTEXT}"' + cleanWs() + } + } +} diff --git a/docker-bake.hcl b/docker-bake.hcl new file mode 100644 index 0000000..cd59030 --- /dev/null +++ b/docker-bake.hcl @@ -0,0 +1,17 @@ +group "default" { + targets = [ + "tideways", + ] +} +target "tideways" { + platforms = [ + "linux/amd64", + "linux/arm64", + ] + args = { + SOURCE_IMAGE = "quay.io/inviqa_images/tideways:latest", + } + tags = [ + "quay.io/inviqa_images/tideways:latest", + ] +} diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index d994b2a..0000000 --- a/docker-compose.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: '3' - -services: - tideways: - image: quay.io/inviqa_images/tideways - build: . From f0018d6d326b90fde1d8ac8e4ac4fe1559a568f2 Mon Sep 17 00:00:00 2001 From: Kieren Evans Date: Fri, 6 Oct 2023 23:28:33 +0300 Subject: [PATCH 2/2] Update docker-bake.hcl --- docker-bake.hcl | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-bake.hcl b/docker-bake.hcl index cd59030..634b152 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -8,9 +8,6 @@ target "tideways" { "linux/amd64", "linux/arm64", ] - args = { - SOURCE_IMAGE = "quay.io/inviqa_images/tideways:latest", - } tags = [ "quay.io/inviqa_images/tideways:latest", ]