2024-07-08 21:24:42 +00:00
|
|
|
FROM --platform=$BUILDPLATFORM golang:1.22 AS builder
|
2020-11-14 15:28:50 +00:00
|
|
|
|
2023-10-18 09:52:48 +00:00
|
|
|
WORKDIR /app
|
2020-11-14 15:28:50 +00:00
|
|
|
|
2023-10-18 09:52:48 +00:00
|
|
|
COPY go.mod ./
|
|
|
|
COPY go.sum ./
|
2024-06-19 15:00:57 +00:00
|
|
|
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all
|
2020-11-14 15:28:50 +00:00
|
|
|
|
2024-11-24 17:32:26 +00:00
|
|
|
COPY ./daemons ./daemons
|
2024-03-28 22:09:11 +00:00
|
|
|
COPY ./pkg ./pkg
|
2023-10-18 09:52:48 +00:00
|
|
|
COPY ./src ./src
|
|
|
|
COPY ./cmd ./cmd
|
2024-06-28 13:08:30 +00:00
|
|
|
|
|
|
|
ARG TARGETOS TARGETARCH
|
2024-08-15 08:23:44 +00:00
|
|
|
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
|
2020-11-14 15:28:50 +00:00
|
|
|
|
2023-10-18 09:52:48 +00:00
|
|
|
FROM scratch
|
2020-11-14 15:28:50 +00:00
|
|
|
|
2023-10-18 09:52:48 +00:00
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
COPY --from=builder /tstor /tstor
|
2020-11-14 15:28:50 +00:00
|
|
|
|
2023-10-18 09:52:48 +00:00
|
|
|
ENTRYPOINT ["/tstor"]
|