diff --git a/Dockerfile b/Dockerfile index 114bebc..f57c273 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,15 @@ -FROM golang:1.22-bookworm AS builder +ARG BUILDPLATFROM + +FROM --platform=$BUILDPLATFORM golang:1.22-bookworm AS builder ARG TARGETOS ARG TARGETARCH +ARG TARGETPLATFROM ENV GO111MODULE=on \ CGO_ENABLED=0 \ GOOS=${TARGETOS} \ - GOARCH=${TARGETARCH} \ - GOBIN=/dist + GOARCH=${TARGETARCH} WORKDIR /app @@ -18,9 +20,9 @@ RUN go mod download COPY . . -RUN go install -ldflags="-w -s" . +RUN go build -o /dist/kubestr -ldflags="-w -s" . -FROM alpine:3.19 +FROM --platform=$TARGETPLATFORM alpine:3.19 RUN apk --no-cache add fio