ЛР 5 — асинхронная обработка и версии pipeline

This commit is contained in:
2026-11-16 02:38:13 +03:00
parent 276dbdad8a
commit 1f535f1b5b
163 changed files with 17194 additions and 24 deletions
+45
View File
@@ -0,0 +1,45 @@
FROM golang:1.27.1-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/api/ ./cmd/api/
COPY cmd/jobs/ ./cmd/jobs/
COPY cmd/relay/ ./cmd/relay/
COPY internal/ ./internal/
RUN --mount=type=cache,id=highload-go-build,target=/root/.cache/go-build,sharing=locked \
CGO_ENABLED=0 GOOS=linux go build -p 2 -trimpath -o /app/server ./cmd/api && \
CGO_ENABLED=0 GOOS=linux go build -p 2 -trimpath -o /app/jobs ./cmd/jobs && \
CGO_ENABLED=0 GOOS=linux go build -p 2 -trimpath -o /app/relay ./cmd/relay
FROM alpine:3.22 AS runtime
RUN addgroup -S app && adduser -S app -G app
WORKDIR /app
USER app
FROM runtime AS cleanup
COPY --from=builder /app/jobs ./jobs
ENTRYPOINT ["/app/jobs"]
CMD ["cleanup"]
FROM runtime AS relay
COPY --from=builder /app/relay ./relay
CMD ["./relay"]
FROM runtime AS api
COPY --from=builder /app/server ./server
EXPOSE 8080
HEALTHCHECK --interval=10s --timeout=3s --start-period=3s --retries=3 \
CMD wget -q -O /dev/null http://127.0.0.1:8080/health/ready || exit 1
CMD ["./server"]