fix: Dockerfile auto-suffisant — clone viewLogs/viewServices depuis Forgejo

Supprime la dépendance au contexte parent (context: ..).
Le Dockerfile clone viewLogs et viewServices depuis git pendant le build,
dans /workspace/ pour correspondre aux replace directives go.mod (../../).
docker-compose.yml revient à context: ./backend — fonctionne quelle que
soit la structure de répertoires sur le serveur.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
enzo 2026-03-22 16:01:33 +01:00
parent cbf87a87fc
commit 4b1a0a09a8
2 changed files with 15 additions and 11 deletions

View file

@ -1,19 +1,23 @@
# ── Étape 1 : Build du binaire Go ────────────────────────────────────────── # ── Étape 1 : Build du binaire Go ──────────────────────────────────────────
# Build context = proxmoxPanel/ (parent de core/) # Build context = core/backend/ (pas besoin du répertoire parent)
# Les modules viewLogs et viewServices sont clonés depuis Forgejo pendant le build.
FROM golang:1.26-alpine AS builder FROM golang:1.26-alpine AS builder
# Dépendances de compilation (git pour les modules Go) RUN apk add --no-cache git ca-certificates
RUN apk add --no-cache git
WORKDIR /workspace # Cloner les modules dans la même arborescence que les replace directives go.mod
# go.mod: replace ../../viewLogs → depuis /workspace/core/backend/ = /workspace/viewLogs ✓
# Copier les sources des trois modules RUN git clone https://git.geronzi.fr/proxmoxPanel/viewLogs /workspace/viewLogs
COPY core/backend/ ./core/backend/ RUN git clone https://git.geronzi.fr/proxmoxPanel/viewServices /workspace/viewServices
COPY viewLogs/ ./viewLogs/
COPY viewServices/ ./viewServices/
WORKDIR /workspace/core/backend WORKDIR /workspace/core/backend
# Copier les fichiers de dépendances (optimise le cache Docker)
COPY go.mod go.sum ./
# Copier tout le code source du CORE
COPY . .
# Télécharger les dépendances # Télécharger les dépendances
RUN go mod download RUN go mod download

View file

@ -7,8 +7,8 @@ services:
# ── Backend Go (API + WebSocket) ──────────────────────────────────────── # ── Backend Go (API + WebSocket) ────────────────────────────────────────
backend: backend:
build: build:
context: .. context: ./backend
dockerfile: core/backend/Dockerfile dockerfile: Dockerfile
container_name: proxmoxpanel-backend container_name: proxmoxpanel-backend
restart: unless-stopped restart: unless-stopped
expose: expose: