FROM golang:1.24-alpine AS builder
RUN apk add --no-cache git ca-certificates
WORKDIR /src
RUN git clone --depth 1 --branch v2.3.0 https://github.com/micromdm/scep.git .
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/scepserver ./cmd/scepserver

FROM alpine:3.22
RUN apk add --no-cache ca-certificates
COPY --from=builder /out/scepserver /usr/local/bin/scepserver
USER 10001:10001
ENTRYPOINT ["/usr/local/bin/scepserver"]

