diff --git a/Dockerfile b/Dockerfile index f6640c1..89d9a38 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM flowdocker/play_builder:latest-java17 as builder +FROM flowdocker/play_builder:latest-java17-jammy as builder ADD . /opt/play WORKDIR /opt/play RUN SBT_OPTS="-Xms1024M -Xmx2048M -Xss2M -XX:MaxMetaspaceSize=2048M" sbt clean stage diff --git a/Jenkinsfile b/Jenkinsfile index 655a6ea..e9dd21c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -57,8 +57,95 @@ pipeline { } } } - stage("All in parallel") { - parallel { + + stage("Build, Deploy, SBT test") { + stages { + stage('Build and deploy') { + // when { branch 'main' } + stages { + stage('Build and push docker image release') { + stages { + stage("parallel image builds") { + parallel { + stage("Build x86_64/amd64 registry image") { + steps { + container('kaniko') { + script { + String semversion = VERSION.printable() + imageBuild( + orgName: 'flowcommerce', + serviceName: 'registry', + platform: 'amd64', + dockerfilePath: '/Dockerfile', + // semver: semversion + semver: 'test' + ) + } + } + } + } + stage("Build arm64 registry image") { + agent { + kubernetes { + label 'registry-arm64' + inheritFrom 'kaniko-slim-arm64' + } + } + steps { + container('kaniko') { + script { + String semversion = VERSION.printable() + imageBuild( + orgName: 'flowcommerce', + serviceName: 'registry', + platform: 'arm64', + dockerfilePath: '/Dockerfile', + // semver: semversion + semver: 'test' + ) + } + } + } + } + } + } + } + } + stage('manifest tool step for registry docker images') { + steps { + container('kaniko') { + script { + // semver = VERSION.printable() + semver = VERSION.printable() + String templateName = "registry-ARCH:${semver}" + String targetName = "registry:${semver}" + String orgName = "flowcommerce" + String jenkinsAgentArch = "amd64" + manifestTool(templateName, targetName, orgName, jenkinsAgentArch) + } + } + } + } + stage('Deploy service') { + when { branch 'main' } + stages { + stage("parallel service Deploy") { + parallel { + stage('Deploy registry') { + steps { + script { + container('helm') { + new helmCommonDeploy().deploy('registry', 'production', VERSION.printable()) + } + } + } + } + } + } + } + } + } + } stage('SBT Test') { steps { container('play') { @@ -81,34 +168,6 @@ pipeline { } } } - stage('build and deploy registry') { - when { branch 'main' } - stages { - stage('Build and push docker image release') { - steps { - container('kaniko') { - script { - semver = VERSION.printable() - sh """ - /kaniko/executor -f `pwd`/Dockerfile -c `pwd` \ - --snapshot-mode=redo --use-new-run \ - --destination ${env.ORG}/registry:$semver - """ - } - } - } - } - stage('deploy registry') { - steps { - script { - container('helm') { - new helmCommonDeploy().deploy('registry', 'production', VERSION.printable()) - } - } - } - } - } - } } } }