From 9f40b572cd96e44aa08814628b06f446fcf559ce Mon Sep 17 00:00:00 2001 From: Saya Andy Date: Mon, 22 Jun 2026 21:55:11 +0700 Subject: fix: specify resource constraints for kaniko container fix: explicitly set goos/goarch for dockerfile --- Dockerfile | 6 ++++-- Jenkinsfile | 14 +++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 37fe431..d0b6621 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,9 @@ FROM golang:1.26.4-alpine3.24 AS build-stage -ENV GOOS=linux -ENV GOARCH=amd64 +ARG TARGETOS=linux +ARG TARGETARCH=amd64 +ENV GOOS=${TARGETOS} +ENV GOARCH=${TARGETARCH} RUN apk add --no-cache sqlite-dev musl-dev gcc diff --git a/Jenkinsfile b/Jenkinsfile index 2eb561b..c9103e8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -48,6 +48,14 @@ spec: imagePullPolicy: Always command: [ /busybox/cat ] tty: true + resources: + requests: + cpu: "1" + memory: 2Gi + ephemeral-storage: 4Gi + limits: + memory: 4Gi + ephemeral-storage: 8Gi """ } } @@ -69,7 +77,11 @@ spec: 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 + /kaniko/executor --context `pwd` \ + --custom-platform=${GOOS}/${GOARCH} \ + --build-arg TARGETOS=${GOOS} + --build-arg TARGETARCH=${GOARCH} + --destination $pushToTags ''' } catch (Exception e) { echo "Caught exception: ${e.getMessage()}" -- cgit v1.3.1+13