UP
This commit is contained in:
parent
6117ab5b91
commit
9110ab9ec3
28
Dockerfile
28
Dockerfile
@ -1,19 +1,19 @@
|
|||||||
# ----- build -----
|
FROM golang:1.24
|
||||||
FROM golang:1.24 AS builder
|
|
||||||
WORKDIR /src
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copie les fichiers de dépendances Go
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
|
# Copie tout le reste (code + web + assets)
|
||||||
COPY . .
|
COPY . .
|
||||||
# Si ton main est à la racine (main.go), garde ./ ; sinon mets le chemin du main
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /out/shelfy .
|
|
||||||
|
|
||||||
# ----- runtime -----
|
# Build de ton binaire
|
||||||
FROM alpine:3.20
|
RUN go build -o shelfy .
|
||||||
# sh est présent (utile pour le "tee")
|
|
||||||
RUN adduser -D -u 10001 appuser
|
# Expose les ports nécessaires
|
||||||
WORKDIR /app
|
EXPOSE 8080 2121
|
||||||
COPY --from=builder /out/shelfy /app/shelfy
|
|
||||||
RUN chmod +x /app/shelfy && mkdir -p /app/data /app/upload /var/log/shelfy && chown -R appuser:appuser /app
|
# Commande de lancement
|
||||||
USER appuser
|
CMD ["./shelfy"]
|
||||||
ENTRYPOINT ["/bin/sh","-c","/app/shelfy 2>&1 | tee -a /var/log/shelfy/shelfy.log"]
|
|
||||||
|
|||||||
@ -9,17 +9,14 @@ services:
|
|||||||
working_dir: /app
|
working_dir: /app
|
||||||
ports:
|
ports:
|
||||||
- "8090:8080"
|
- "8090:8080"
|
||||||
- "2121:2121"
|
- "2121:2121" # si tu gardes FTP
|
||||||
- "30000-30100:30000-30100"
|
- "30000-30100:30000-30100" # si tu gardes FTP
|
||||||
- "2222:2222"
|
- "2222:2222" # SFTP
|
||||||
|
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
- "dockerhost:host-gateway"
|
- "dockerhost:host-gateway" # accès à l'hôte depuis le conteneur
|
||||||
environment:
|
|
||||||
- SHELFY_DATA_DIR=/app/data
|
|
||||||
volumes:
|
volumes:
|
||||||
- shelfy_upload:/app/upload
|
- shelfy_upload:/app/upload
|
||||||
- shelfy_data:/app/data
|
|
||||||
- shelfy_logs:/var/log/shelfy
|
|
||||||
labels:
|
labels:
|
||||||
- traefik.http.routers.shelfy.middlewares=webdav-allow-methods@docker
|
- traefik.http.routers.shelfy.middlewares=webdav-allow-methods@docker
|
||||||
- traefik.http.middlewares.webdav-allow-methods.headers.accesscontrolallowmethods=GET,PUT,POST,DELETE,PROPFIND,OPTIONS,LOCK,UNLOCK,HEAD
|
- traefik.http.middlewares.webdav-allow-methods.headers.accesscontrolallowmethods=GET,PUT,POST,DELETE,PROPFIND,OPTIONS,LOCK,UNLOCK,HEAD
|
||||||
@ -28,23 +25,6 @@ services:
|
|||||||
- 8.8.8.8
|
- 8.8.8.8
|
||||||
- 1.1.1.1
|
- 1.1.1.1
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
# (pas besoin d'un command ici si l'ENTRYPOINT du Dockerfile fait déjà le tee)
|
|
||||||
|
|
||||||
fail2ban:
|
|
||||||
image: crazymax/fail2ban:latest
|
|
||||||
container_name: fail2ban
|
|
||||||
network_mode: host
|
|
||||||
cap_add: [ "NET_ADMIN", "NET_RAW" ]
|
|
||||||
environment:
|
|
||||||
- TZ=Europe/Paris
|
|
||||||
- F2B_LOG_TARGET=STDOUT
|
|
||||||
- F2B_DB_PURGE_AGE=1d
|
|
||||||
volumes:
|
|
||||||
- ./fail2ban:/data
|
|
||||||
- shelfy_logs:/var/log/shelfy:ro
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
shelfy_upload:
|
shelfy_upload:
|
||||||
shelfy_data:
|
|
||||||
shelfy_logs:
|
|
||||||
|
|||||||
8
main.go
8
main.go
@ -249,13 +249,9 @@ func startHTTP() {
|
|||||||
c.File("./web/index.html")
|
c.File("./web/index.html")
|
||||||
})
|
})
|
||||||
|
|
||||||
addr := ":8080" // ⚠️ si LocalAI tourne déjà sur 8080, change par ":8082"
|
log.Println("[HTTP] Serveur Gin sur http://0.0.0.0:8080")
|
||||||
log.Printf("[HTTP] Serveur Gin sur http://0.0.0.0%s", addr)
|
_ = app.Run(":8080")
|
||||||
if err := app.Run(addr); err != nil {
|
|
||||||
log.Fatalf("[HTTP] Erreur lancement: %v", err)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// SFTP sur 2222 (root = ./upload)
|
// SFTP sur 2222 (root = ./upload)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user