diff --git a/Dockerfile b/Dockerfile index 89207ed..4e6bb68 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.22 as builder +FROM --platform=$BUILDPLATFORM golang:1.22 as builder WORKDIR /app @@ -14,7 +14,9 @@ COPY ./templates ./templates COPY embed.go embed.go RUN go generate ./... -RUN --mount=type=cache,mode=0777,target=/go/pkg/mod CGO_ENABLED=0 go build -tags timetzdata -o /tstor ./cmd/tstor/main.go + +ARG TARGETOS TARGETARCH +RUN --mount=type=cache,mode=0777,target=/go/pkg/mod CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -tags timetzdata -o /tstor ./cmd/tstor/main.go FROM scratch