summaryrefslogtreecommitdiffci
diff options
from:
to:
context:
space:
mode:
authorGravatar Saya Andy <saya.andy@posteo.com> 2026-06-22 21:30:55 +0700
committerGravatar Saya Andy <saya.andy@posteo.com> 2026-06-22 21:30:55 +0700
commit1ce3d644faf8e0372cc63f7fb3b15a33a94cd7f4 (patch)
tree6d4dd8a562f20d642aa6102dbba2e9e99f848595
parent1c54aa1c4d87966e37dda72630642943a022b09c (diff)
downloadweb-1ce3d644faf8e0372cc63f7fb3b15a33a94cd7f4.tar.gz
web-1ce3d644faf8e0372cc63f7fb3b15a33a94cd7f4.zip
feat: build image both for amd64 and arm64
-rw-r--r--Dockerfile3
-rw-r--r--Jenkinsfile98
2 files changed, 60 insertions, 41 deletions
diff --git a/Dockerfile b/Dockerfile
index 58ba7f4..37fe431 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,8 @@
FROM golang:1.26.4-alpine3.24 AS build-stage
+ENV GOOS=linux
+ENV GOARCH=amd64
+
RUN apk add --no-cache sqlite-dev musl-dev gcc
WORKDIR /builddir
diff --git a/Jenkinsfile b/Jenkinsfile
index f565210..3bafa38 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -18,50 +18,66 @@ pipeline {
stash name: 'tailwindcss-output', includes: 'static/output.css'
}
}
-
+
stage('Build') {
- agent {
- kubernetes {
- defaultContainer 'kaniko'
- yaml """
-apiVersion: v1
-kind: Pod
-metadata:
- name: kaniko-sayauz-web
- namespace: jenkins
-spec:
- containers:
- - name: kaniko
- image: gcr.io/kaniko-project/executor:v1.24.0-debug
- imagePullPolicy: Always
- command: [ /busybox/cat ]
- tty: true
-"""
+ matrix {
+ axes {
+ axis {
+ name 'GOOS'
+ values 'linux'
+ }
+ axis {
+ name 'GOARCH'
+ values 'arm64', 'amd64'
+ }
}
}
- environment {
- IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web"
- }
- steps {
- checkout scm
- unstash 'tailwindcss-output'
- container(name: 'kaniko', shell: '/busybox/sh') {
- withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) {
- withEnv(['PATH+EXTRA=/busybox']) {
- try {
- sh '''#!/busybox/sh
- mkdir -p /kaniko/.docker
- echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json
- pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`"
- if [ "$TAG_NAME" != "" ]; then
- pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME"
- fi
- /kaniko/executor --context `pwd` --destination $pushToTags
- '''
- } catch (Exception e) {
- echo "Caught exception: ${e.getMessage()}"
- currentBuild.result = 'FAILURE'
- throw e
+ stages {
+ stage('Build') {
+ agent {
+ kubernetes {
+ defaultContainer 'kaniko'
+ yaml """
+ apiVersion: v1
+ kind: Pod
+ metadata:
+ name: kaniko-sayauz-web
+ namespace: jenkins
+ spec:
+ containers:
+ - name: kaniko
+ image: gcr.io/kaniko-project/executor:v1.24.0-debug
+ imagePullPolicy: Always
+ command: [ /busybox/cat ]
+ tty: true
+ """
+ }
+ }
+ environment {
+ IMAGE_PUSH_DESTINATION="registry.sayag.it/sayauz/web"
+ }
+ steps {
+ checkout scm
+ unstash 'tailwindcss-output'
+ container(name: 'kaniko', shell: '/busybox/sh') {
+ withCredentials([file(credentialsId: 'registry-sayagit-jenkins-password', variable: 'REGISTRY_SAYAGIT_JENKINS_PASSWORD')]) {
+ withEnv(['PATH+EXTRA=/busybox']) {
+ try {
+ sh '''#!/busybox/sh
+ mkdir -p /kaniko/.docker
+ echo "{\"auths\":{\"https://registry.sayag.it\":{\"username\":\"jenkins\",\"password\":\"$REGISTRY_SAYAGIT_JENKINS_PASSWORD\"}}}" > /kaniko/.docker/config.json
+ pushToTags="$IMAGE_PUSH_DESTINATION:latest $IMAGE_PUSH_DESTINATION:commit-`git rev-parse --short HEAD`"
+ if [ "$TAG_NAME" != "" ]; then
+ pushToTags="$pushToTags $IMAGE_PUSH_DESTINATION:stable $IMAGE_PUSH_DESTINATION:$TAG_NAME"
+ fi
+ /kaniko/executor --context `pwd` --custom-platform=${GOOS}/${GOARCH} --destination $pushToTags
+ '''
+ } catch (Exception e) {
+ echo "Caught exception: ${e.getMessage()}"
+ currentBuild.result = 'FAILURE'
+ throw e
+ }
+ }
}
}
}