forked from mtusi2026/mtusi2026lab3
30 lines
520 B
Docker
30 lines
520 B
Docker
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 internal/ ./internal/
|
|
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -o /app/server ./cmd/api
|
|
|
|
|
|
FROM alpine:3.22
|
|
|
|
RUN addgroup -S app && adduser -S app -G app
|
|
|
|
WORKDIR /app
|
|
|
|
COPY --from=builder /app/server ./server
|
|
|
|
USER app
|
|
|
|
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"]
|