# syntax=docker/dockerfile:1 FROM golang:1.23.4-alpine3.21 AS build WORKDIR /src COPY src/go.mod src/go.sum ./ RUN go mod download COPY src/ ./ ENV CGO_ENABLED=0 RUN go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server FROM alpine:3.21.2 AS runtime RUN addgroup -S app && adduser -S -G app app WORKDIR /app COPY --from=build /out/server /app/server ARG APP_BUILD=dev ENV APP_BUILD=$APP_BUILD LABEL org.opencontainers.image.revision=$APP_BUILD USER app EXPOSE 8080 ENV APP_HOST=0.0.0.0 APP_PORT=8080 HEALTHCHECK --interval=5s --timeout=3s --start-period=5s --retries=3 \ CMD wget -q -O /dev/null http://127.0.0.1:8080/health/ready || exit 1 ENTRYPOINT ["/app/server"]