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

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