konfa-server/Dockerfile

33 lines
720 B
Text
Raw Permalink Normal View History

2024-12-23 14:21:58 +00:00
FROM --platform=${BUILDPLATFORM} golang:1.23 AS builder
ARG TARGETPLATFORM
ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
2024-12-23 12:54:51 +00:00
RUN go build -v std
WORKDIR /app
COPY go.mod ./
COPY go.sum ./
2024-12-23 14:21:58 +00:00
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod go mod download all
2024-12-23 12:54:51 +00:00
COPY ./cmd ./cmd
COPY ./pkg ./pkg
COPY ./src ./src
2024-12-23 14:21:58 +00:00
RUN --mount=type=cache,mode=0777,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -tags timetzdata -o /server ./cmd/main.go
2024-12-23 12:54:51 +00:00
# run container
FROM scratch
#Adding root serts for ssl
2024-12-23 14:21:58 +00:00
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /server /app/konfa-server
2024-12-23 12:54:51 +00:00
WORKDIR /app
ENTRYPOINT [ "/app/konfa-server" ]