tstor/Dockerfile

32 lines
565 B
Text
Raw Normal View History

#===============
# Stage 1: Build
#===============
2023-10-17 20:12:07 +00:00
FROM golang:1.21 as builder
2023-10-17 20:12:07 +00:00
WORKDIR /app
2023-10-17 20:12:07 +00:00
COPY go.mod ./
COPY go.sum ./
RUN go mod download
2023-10-17 20:12:07 +00:00
COPY ./src ./src
COPY ./cmd ./cmd
COPY ./assets ./assets
COPY ./templates ./templates
COPY embed.go embed.go
2023-10-17 20:12:07 +00:00
RUN go generate ./...
RUN CGO_ENABLED=0 go build -tags timetzdata -o /tstor ./cmd/tstor/main.go
#===============
# Stage 2: Run
#===============
2023-10-17 20:12:07 +00:00
FROM scratch
2023-10-17 20:12:07 +00:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /tstor /tstor
2023-10-17 20:12:07 +00:00
ENTRYPOINT ["/tstor"]