faster docker builds

This commit is contained in:
royalcat 2024-06-28 16:08:30 +03:00
parent 0fa3a91447
commit 13ce2aa07f

View file

@ -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