File tree Expand file tree Collapse file tree 1 file changed +20
-6
lines changed
Expand file tree Collapse file tree 1 file changed +20
-6
lines changed Original file line number Diff line number Diff line change 1- FROM golang:1.26-alpine AS builder
1+ # syntax=docker/dockerfile:1
2+ FROM --platform=$BUILDPLATFORM golang:1.26-alpine AS builder
23
34WORKDIR /build
45
5- RUN apk update && apk add upx
6+ # Install build dependencies
7+ RUN apk update && apk add --no-cache upx git
68
79ARG VERSION=main
10+ ARG TARGETPLATFORM
11+ ARG BUILDPLATFORM
12+ ARG TARGETOS
13+ ARG TARGETARCH
14+
815ENV GO111MODULE=on \
9- CGO_ENABLED=0 \
10- GOOS=linux
16+ CGO_ENABLED=0
17+
1118COPY . .
1219
13- RUN go build -a -installsuffix cgo -ldflags="-w -s -X github.com/bakito/k8s-event-logger-operator/version.Version=${VERSION}" -o k8s-event-logger && \
14- upx -q k8s-event-logger
20+ RUN --mount=type=cache,target=/go/pkg/mod \
21+ --mount=type=cache,target=/root/.cache/go-build \
22+ GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
23+ go build \
24+ -a \
25+ -installsuffix cgo \
26+ -ldflags="-w -s -X github.com/bakito/k8s-event-logger-operator/version.Version=${VERSION}" \
27+ -o k8s-event-logger . && \
28+ upx -q k8s-event-logger
1529
1630# application image
1731FROM scratch
You can’t perform that action at this time.
0 commit comments