File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 // Convert Windows paths to Docker-compatible format (forward slashes)
4444 var astroPath = Path . Combine ( repoRoot , "astro" ) . Replace ( '\\ ' , '/' ) ;
4545 var outputPath = wwwrootDir . Replace ( '\\ ' , '/' ) ;
46+ var gitPath = Path . Combine ( repoRoot , ".git" ) . Replace ( '\\ ' , '/' ) ;
47+
48+ // Pass GITHUB_TOKEN into the container if set
49+ var githubToken = Environment . GetEnvironmentVariable ( "GITHUB_TOKEN" ) ?? "" ;
4650
4751 // Use Docker to build Astro - consistent across all platforms
4852 // Use Debian-based image (not Alpine) for better compatibility with native modules
4953 // Increase Node.js memory limit to handle large builds
54+ // Mount .git so git log works inside the container
5055 await RunAsync ( "docker" ,
5156 "run --rm " +
5257 $ "-v \" { astroPath } :/app\" " +
5358 $ "-v \" { outputPath } :/output\" " +
59+ $ "-v \" { gitPath } :/app/.git\" " +
5460 "-w /app " +
5561 "-e NODE_OPTIONS=\" --max-old-space-size=8192\" " +
62+ $ "-e GITHUB_TOKEN=\" { githubToken } \" " +
5663 "node:24-slim " +
5764 "sh -c \" apt-get update && apt-get install -y git && npm ci && npm run build && cp -r dist/. /output/\" " ,
5865 configureEnvironment : env => env . Add ( "MSYS_NO_PATHCONV" , "1" ) ) ;
You can’t perform that action at this time.
0 commit comments