feat: v1
This commit is contained in:
29
backend/Dockerfile
Normal file
29
backend/Dockerfile
Normal file
@ -0,0 +1,29 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ---- Étape de build ----
|
||||
FROM golang:1.23-alpine AS build
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Téléchargement des dépendances en couche séparée pour profiter du cache.
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copie du code source et compilation d'un binaire statique.
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server
|
||||
|
||||
# ---- Image finale (distroless, légère) ----
|
||||
FROM gcr.io/distroless/static-debian12:nonroot
|
||||
|
||||
# Copie du binaire statique.
|
||||
COPY --from=build /out/server /server
|
||||
|
||||
# Le dossier de stockage est monté via un volume (cf. docker-compose).
|
||||
ENV STORAGE_PATH=/data/documents
|
||||
ENV PORT=8080
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
USER nonroot:nonroot
|
||||
ENTRYPOINT ["/server"]
|
||||
Reference in New Issue
Block a user