27 lines
565 B
Docker
27 lines
565 B
Docker
# Build stage
|
|
FROM golang:1.25-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache ca-certificates
|
|
|
|
ENV GOPRIVATE=git.daviestechlabs.io
|
|
ENV GONOSUMCHECK=git.daviestechlabs.io
|
|
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=secret,id=netrc,target=/root/.netrc go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux GOAMD64=v3 go build -ldflags="-w -s" -o /chat-handler .
|
|
|
|
# Runtime stage
|
|
FROM scratch
|
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
|
COPY --from=builder /chat-handler /chat-handler
|
|
|
|
USER 65534:65534
|
|
|
|
ENTRYPOINT ["/chat-handler"]
|