forked from mtusi2026/mtusi2026lab5
- RabbitMQ quorum queue, persistent messages and publisher confirms - S3 staging plus PostgreSQL attachments/jobs outbox transaction - worker variants (thumbnail, crop, optimized WebP), DB lease and lease sweeper - jittered retry, permanent failures, explicit replay and admission cap - deterministic crash hooks, resilience script and evidence for grade 4 - async-aware custom tests, oversized pixel case, docs and changelog
26 lines
961 B
Docker
26 lines
961 B
Docker
FROM golang:1.27.1-alpine AS build
|
|
|
|
WORKDIR /src
|
|
COPY app/go.mod app/go.sum ./
|
|
RUN go mod download
|
|
COPY app/ ./
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/worker ./cmd/worker \
|
|
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/reconciler ./cmd/reconciler
|
|
|
|
FROM alpine:3.22
|
|
|
|
# AGENT: the runtime image needs no package manager at build time; copying the
|
|
# CA bundle from the Go builder avoids a network dependency on Alpine mirrors.
|
|
RUN addgroup -S -g 10001 app \
|
|
&& adduser -S -u 10001 -G app app
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
COPY --from=build /out/server /usr/local/bin/server
|
|
COPY --from=build /out/worker /usr/local/bin/worker
|
|
COPY --from=build /out/reconciler /usr/local/bin/reconciler
|
|
|
|
USER app
|
|
EXPOSE 8080
|
|
ENTRYPOINT ["/usr/local/bin/server"]
|