forked from mtusi2026/mtusi2026lab7
на оценку 4
This commit is contained in:
+42
@@ -0,0 +1,42 @@
|
||||
FROM golang:1.27.3-alpine@sha256:fa3d596898d9f126af7c01d14ee7597bab3f39cccf392ef36b69fe77cd681f18 AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY cmd/ ./cmd/
|
||||
COPY internal/ ./internal/
|
||||
|
||||
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-w -s" -o /build/server ./cmd/server/main.go
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-w -s" -o /build/reconciler ./cmd/reconciler/main.go
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-w -s" -o /build/worker ./cmd/worker/main.go
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-w -s" -o /build/dispatcher ./cmd/dispatcher/main.go
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-w -s" -o /build/jobctl ./cmd/jobctl/main.go
|
||||
|
||||
FROM alpine:3.24@sha256:f59abe656b692d901e184be3445e084786602108599d2a51d229c0f5a48c71bf
|
||||
|
||||
RUN apk upgrade --no-cache && \
|
||||
apk add --no-cache ca-certificates curl openssl
|
||||
|
||||
RUN addgroup -g 1000 appgroup && \
|
||||
adduser -u 1000 -G appgroup -s /bin/sh -D appuser
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /build/server /app/server
|
||||
COPY --from=builder /build/reconciler /app/reconciler
|
||||
COPY --from=builder /build/worker /app/worker
|
||||
COPY --from=builder /build/dispatcher /app/dispatcher
|
||||
COPY --from=builder /build/jobctl /app/jobctl
|
||||
|
||||
RUN chown -R appuser:appgroup /app
|
||||
|
||||
USER appuser:appgroup
|
||||
|
||||
EXPOSE 8444
|
||||
|
||||
|
||||
ENTRYPOINT ["/app/server"]
|
||||
|
||||
Reference in New Issue
Block a user