init
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
# --- مرحله 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
|
||||
EXPOSE 8080
|
||||
VOLUME ["/data"]
|
||||
USER nonroot:nonroot
|
||||
ENTRYPOINT ["/app/server"]
|
||||
Reference in New Issue
Block a user