From 13ce2aa07fb6cccf5b544c137170789d9f5a4e39 Mon Sep 17 00:00:00 2001 From: royalcat Date: Fri, 28 Jun 2024 16:08:30 +0300 Subject: [PATCH] faster docker builds --- Dockerfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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