fix: VERSION généré par build.sh avant docker build (pas dans Dockerfile)
- build.sh: git describe --tags --dirty > backend/VERSION avant docker compose build - Dockerfile: COPY backend/VERSION (pré-généré, plus fiable que .git dans le contexte) - .dockerignore: revert (plus besoin d'autoriser .git/HEAD) - .gitignore: backend/VERSION (généré, pas commité)
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
.git
|
.git
|
||||||
!.git/HEAD
|
|
||||||
!.git/refs/
|
|
||||||
.gitignore
|
.gitignore
|
||||||
.gitattributes
|
.gitattributes
|
||||||
__pycache__
|
__pycache__
|
||||||
|
|||||||
@@ -24,4 +24,5 @@ playwright-report/
|
|||||||
desktop/target/
|
desktop/target/
|
||||||
desktop/python-embed/
|
desktop/python-embed/
|
||||||
desktop/frontend-static/
|
desktop/frontend-static/
|
||||||
|
backend/VERSION
|
||||||
|
|
||||||
|
|||||||
+2
-15
@@ -31,21 +31,8 @@ RUN apt-get update \
|
|||||||
COPY backend/ ./backend/
|
COPY backend/ ./backend/
|
||||||
COPY frontend/ ./frontend/
|
COPY frontend/ ./frontend/
|
||||||
|
|
||||||
# Generate VERSION file from git (fallback for version.py when .git is not available)
|
# Copy pre-generated VERSION file (generated by build.sh before docker build)
|
||||||
COPY .git/HEAD .git/refs/ /tmp/git-refs/
|
COPY backend/VERSION ./backend/VERSION
|
||||||
RUN cd /tmp/git-refs && \
|
|
||||||
if [ -f HEAD ]; then \
|
|
||||||
REF=$(cat HEAD | awk '{print $2}'); \
|
|
||||||
if [ -f "$REF" ]; then \
|
|
||||||
HASH=$(cat "$REF" | head -c 8); \
|
|
||||||
echo "1.8.0-0-g${HASH}" > /app/backend/VERSION; \
|
|
||||||
else \
|
|
||||||
echo "1.8.0-dev" > /app/backend/VERSION; \
|
|
||||||
fi; \
|
|
||||||
else \
|
|
||||||
echo "1.8.0-dev" > /app/backend/VERSION; \
|
|
||||||
fi && \
|
|
||||||
rm -rf /tmp/git-refs
|
|
||||||
|
|
||||||
# Create non-root user for security + data directory for auth persistence
|
# Create non-root user for security + data directory for auth persistence
|
||||||
# Using explicit UID/GID 1000 to match common host user and docker-compose settings
|
# Using explicit UID/GID 1000 to match common host user and docker-compose settings
|
||||||
|
|||||||
@@ -193,6 +193,11 @@ else
|
|||||||
info "Construction de l'image Docker (avec cache)..."
|
info "Construction de l'image Docker (avec cache)..."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Generate VERSION file from git before Docker build
|
||||||
|
VERSION=$(git describe --tags --dirty 2>/dev/null | sed 's/^v//' || echo "0.0.0-dev")
|
||||||
|
echo "$VERSION" > backend/VERSION
|
||||||
|
info "Version: $VERSION"
|
||||||
|
|
||||||
$COMPOSE_CMD -f "$COMPOSE_FILE" build "${BUILD_FLAGS[@]}" "${BUILD_ARGS[@]}"
|
$COMPOSE_CMD -f "$COMPOSE_FILE" build "${BUILD_FLAGS[@]}" "${BUILD_ARGS[@]}"
|
||||||
ok "Image construite avec succès"
|
ok "Image construite avec succès"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user