forked from mtusi2026/mtusi2026lab4
22 lines
857 B
Docker
22 lines
857 B
Docker
FROM golang:1.27.1-alpine3.24 AS build
|
|
WORKDIR /src
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
COPY cmd ./cmd
|
|
COPY internal ./internal
|
|
RUN CGO_ENABLED=0 go build -trimpath -o /out/server ./cmd/server \
|
|
&& CGO_ENABLED=0 go build -trimpath -o /out/s3-init ./cmd/s3-init \
|
|
&& CGO_ENABLED=0 go build -trimpath -o /out/reconcile ./cmd/reconcile \
|
|
&& CGO_ENABLED=0 go build -trimpath -o /out/s3tool ./cmd/s3tool
|
|
|
|
FROM alpine:3.24.1
|
|
ARG BUILD_ID=dev
|
|
LABEL org.opencontainers.image.revision=$BUILD_ID
|
|
RUN adduser -D -H -u 10001 app
|
|
COPY --from=build /out/server /out/s3-init /out/reconcile /out/s3tool /usr/local/bin/
|
|
USER app
|
|
ENV APP_HOST=0.0.0.0 APP_PORT=8080
|
|
EXPOSE 8080
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget -q -O /dev/null "http://127.0.0.1:${APP_PORT}/health/ready" || exit 1
|
|
ENTRYPOINT ["/usr/local/bin/server"] |