Files
back-hokm/Dockerfile
T
2026-06-24 10:47:54 +03:30

19 lines
579 B
Docker

# --- مرحله build ---
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# باینری استاتیک (modernc.org/sqlite بدون cgo کار می‌کند)
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/server ./cmd/server
# --- مرحله اجرا (کمترین حجم) ---
FROM gcr.io/distroless/static-debian12
WORKDIR /app
COPY --from=build /out/server /app/server
ENV ADDR=:8080 DB_PATH=/data/hakemsho.db CARDS_DIR=/data/cards
EXPOSE 8080
VOLUME ["/data"]
USER nonroot:nonroot
ENTRYPOINT ["/app/server"]