[Fix] Passa versione MinVer come build-arg al Docker per evitare errore MINVER1001
Il problema era che MinVer veniva eseguito dentro il container Docker dove la directory .git non esiste, causando il warning MINVER1001 e l'uso di 0.0.0-alpha.0 (poi sostituito dal fallback hardcoded 2.1.0). Soluzione: - La versione viene calcolata sul runner CI/CD (dove git e' disponibile) - Esportata come variabile d'ambiente APP_VERSION via GITHUB_ENV - Passata al Docker build tramite --build-arg APP_VERSION - Nei Dockerfile aggiunto ARG APP_VERSION e /p:MinVerVersionOverride per imporla a MinVer senza che tenti di accedere a git (assente nel container) - ARG ridichiarato dopo ogni FROM in multi-stage build (comportamento Docker)
This commit is contained in:
@@ -72,6 +72,9 @@ jobs:
|
||||
echo "Generated version.json:"
|
||||
cat wwwroot/version.json
|
||||
cd ..
|
||||
|
||||
# Esporta la versione come variabile d'ambiente per il Docker build
|
||||
echo "APP_VERSION=$VERSION" >> "$GITHUB_ENV"
|
||||
shell: bash
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
@@ -138,6 +141,7 @@ jobs:
|
||||
platforms: linux/amd64
|
||||
# Aumenta timeout per registry lenti
|
||||
build-args: |
|
||||
APP_VERSION=${{ env.APP_VERSION }}
|
||||
BUILDKIT_STEP_LOG_MAX_SIZE=50000000
|
||||
provenance: false
|
||||
sbom: false
|
||||
@@ -217,6 +221,10 @@ jobs:
|
||||
Write-Host "Generated version.json:"
|
||||
Get-Content "wwwroot\version.json"
|
||||
cd ..
|
||||
|
||||
# Esporta la versione come variabile d'ambiente per il Docker build
|
||||
"APP_VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Write-Host "APP_VERSION=$VERSION esportata per Docker build"
|
||||
shell: pwsh
|
||||
|
||||
- name: Debug - Verify files
|
||||
@@ -267,7 +275,7 @@ jobs:
|
||||
)
|
||||
|
||||
echo Building Windows Docker image...
|
||||
docker build -t temp-windows -f Dockerfile.windows .
|
||||
docker build --build-arg APP_VERSION=%APP_VERSION% -t temp-windows -f Dockerfile.windows .
|
||||
if errorlevel 1 (
|
||||
echo Build failed!
|
||||
exit /b 1
|
||||
|
||||
Reference in New Issue
Block a user