tstor/Dockerfile
royalcat 08a36d8165
Some checks failed
docker / build-docker (linux/amd64) (push) Successful in 2m29s
docker / build-docker (linux/arm64) (push) Failing after 3h11m32s
docker golang build cache
2024-06-19 18:00:57 +03:00

25 lines
581 B
Docker

FROM golang:1.22 as builder
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all
COPY ./pkg ./pkg
COPY ./src ./src
COPY ./cmd ./cmd
COPY ./assets ./assets
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
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /tstor /tstor
ENTRYPOINT ["/tstor"]