forked from mtusi2026/mtusi2026lab5
lab5 na4
This commit is contained in:
+28
@@ -0,0 +1,28 @@
|
||||
FROM golang:1.27-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY cmd ./cmd
|
||||
COPY internal ./internal
|
||||
RUN --mount=type=cache,target=/root/.cache/go-build CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/api ./cmd/api \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/reconcile ./cmd/reconcile \
|
||||
&& CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/worker ./cmd/worker
|
||||
|
||||
FROM alpine:3.20
|
||||
|
||||
RUN apk add --no-cache ca-certificates wget python3 py3-pillow \
|
||||
&& addgroup -S app && adduser -S app -G app
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=builder /out/api /out/reconcile /out/worker ./
|
||||
COPY scripts/process_image.py ./scripts/process_image.py
|
||||
|
||||
USER app
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget -qO- http://127.0.0.1:8080/health/ready || exit 1
|
||||
|
||||
CMD ["./api"]
|
||||
Reference in New Issue
Block a user