# lab-caps:1, the capabilities lesson's test image: capsh/getpcaps from libcap-utils, a tiny Go program that
# prints its user IDs and capability sets, and a second copy of it with the setuid bit (owned by root).
FROM golang:1.27-alpine@sha256:8a5910f31396cd4d89662f56c68b3ae31d374308270a1c3bd96672ee5ed43414 AS build
WORKDIR /src
COPY whoami.go .
RUN CGO_ENABLED=0 go build -o /out/lab-whoami whoami.go

FROM alpine:3.22
RUN apk add --no-cache libcap-utils
COPY --from=build /out/lab-whoami /usr/local/bin/lab-whoami
COPY --from=build /out/lab-whoami /usr/local/bin/lab-suid-whoami
RUN chmod 4755 /usr/local/bin/lab-suid-whoami
USER 10001:10001
