UP
This commit is contained in:
parent
be845fc6f9
commit
31849cf4d3
20
Dockerfile
20
Dockerfile
@ -1,27 +1,19 @@
|
||||
# ---------- build ----------
|
||||
FROM golang:1.24 AS builder
|
||||
WORKDIR /src
|
||||
RUN apk add --no-cache build-base # gcc/make/musl-dev pour cgo
|
||||
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
build-essential ca-certificates && rm -rf /var/lib/apt/lists/*
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
COPY . .
|
||||
# Si ton main est à la racine : "."
|
||||
# Sinon remplace le dernier "." par le chemin du package main.
|
||||
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o /out/shelfy .
|
||||
|
||||
# ---------- runtime ----------
|
||||
FROM alpine:3.20
|
||||
# utilitaires utiles (shell, certificats, timezone)
|
||||
RUN apk add --no-cache ca-certificates tzdata
|
||||
|
||||
FROM debian:bookworm-slim
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
ca-certificates tzdata busybox && rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app
|
||||
COPY --from=builder /out/shelfy /app/shelfy
|
||||
|
||||
# Prépare les répertoires (DB, upload, logs)
|
||||
RUN mkdir -p /app/data /app/upload /var/log/shelfy \
|
||||
&& chmod -R 0775 /var/log/shelfy /app
|
||||
|
||||
# Lance l'appli et duplique les logs vers un fichier pour Fail2ban
|
||||
&& chmod -R 0775 /app /var/log/shelfy
|
||||
ENTRYPOINT ["/bin/sh","-lc","/app/shelfy 2>&1 | tee -a /var/log/shelfy/shelfy.log"]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user