18 lines
619 B
Docker
18 lines
619 B
Docker
# syntax=docker/dockerfile:1.7
|
|
FROM golang:1.24-alpine AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN --mount=type=cache,target=/go/pkg/mod go mod download
|
|
COPY . .
|
|
RUN --mount=type=cache,target=/root/.cache/go-build \
|
|
CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/control-plane .
|
|
|
|
FROM alpine:3.22
|
|
RUN apk add --no-cache ca-certificates tzdata && \
|
|
addgroup -S -g 65532 control && adduser -S -D -H -u 65532 -G control control
|
|
COPY --from=build --chown=65532:65532 /out/control-plane /usr/local/bin/control-plane
|
|
USER 65532:65532
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/control-plane"]
|
|
|