# --- Builder ---
FROM golang:alpine AS builder
WORKDIR /app
COPY go.mod go.sum main.go ./
COPY registry ./registry
COPY web ./web
RUN CGO_ENABLED=0 go build -o registry-browser .

# --- Final Container ---
FROM alpine:3.21

RUN addgroup -S registry && adduser -S registry -G registry

WORKDIR /app

COPY --from=builder --chown=registry:registry /app/registry-browser /usr/local/bin/registry-browser
COPY templates ./templates
COPY assets ./assets

USER registry

EXPOSE 8080

CMD ["registry-browser", "--http=0.0.0.0:8080"]
