FROM golang:1.26-alpine AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -buildvcs=false -ldflags "-s -w" -o /website ./cmd/website

FROM alpine:3.23
RUN adduser -D -H -u 10001 website
COPY --from=build /website /usr/local/bin/website
COPY config/container.conf /etc/website/website.conf
USER website
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 CMD wget -q -O /dev/null http://127.0.0.1:8080/healthz || exit 1
ENTRYPOINT ["/usr/local/bin/website", "-config", "/etc/website/website.conf"]
