diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 8afdd36..418eb14 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -39,7 +39,8 @@ "Bash(git push:*)", "Bash(Start-Sleep -Seconds 10)", "Bash(npm install:*)", - "Bash(npm config get:*)" + "Bash(npm config get:*)", + "Bash(test:*)" ], "deny": [], "ask": [] diff --git a/.dockerignore b/.dockerignore index 6b02f27..befb348 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,7 +7,7 @@ __pycache__ env/ venv/ -# Node modules (critical for fixing esbuild platform issue) +# Node modules - installed inside Docker to ensure correct platform binaries node_modules frontend/node_modules */node_modules diff --git a/Dockerfile b/Dockerfile index de7a141..aa3cb77 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,18 @@ # Multi-stage build: First stage builds Angular frontend FROM node:18-alpine as frontend-builder -# Install dependencies for native modules -RUN apk add --no-cache python3 make g++ - WORKDIR /frontend -# Copy package files +# Copy package files first COPY frontend/package*.json ./ -# Copy .npmrc from frontend directory if it exists (using glob pattern to avoid errors) -# This allows different environments to use different npm registries -# To use: copy your user-level .npmrc to frontend/.npmrc before building -# Unix/Mac: cp ~/.npmrc frontend/.npmrc -# Windows: copy %USERPROFILE%\.npmrc frontend\.npmrc -COPY frontend/.npmr[c] ./ 2>/dev/null || : +# Copy .npmrc if it exists (allows using custom npm registry) +# The quickstart scripts will create this from user's .npmrc +# Using a conditional copy approach +RUN --mount=type=bind,source=frontend,target=/tmp/frontend \ + if [ -f /tmp/frontend/.npmrc ]; then cp /tmp/frontend/.npmrc ./; fi -# Install dependencies using npm install -# This will use the .npmrc configuration if present and generate a package-lock.json -# appropriate for the configured registry (Artifactory or public npm) +# Install dependencies inside Docker (ensures correct platform binaries) RUN npm install # Copy frontend source diff --git a/quickstart.ps1 b/quickstart.ps1 index 63ee5b9..4a98bc5 100644 --- a/quickstart.ps1 +++ b/quickstart.ps1 @@ -18,8 +18,8 @@ if ($Help) { Write-Host " -Help Show this help message" -ForegroundColor White Write-Host "" Write-Host "NPM Registry:" -ForegroundColor Yellow - Write-Host " Create frontend/.npmrc to configure custom npm registry" -ForegroundColor White - Write-Host " The Docker build will use this file if present" -ForegroundColor White + Write-Host " Uses your machine's npm configuration automatically" -ForegroundColor White + Write-Host " npm install runs on host before Docker build" -ForegroundColor White Write-Host "" Write-Host "Brings up the complete stack: database, backend API, and frontend" -ForegroundColor Green Write-Host "" @@ -31,24 +31,19 @@ Write-Host "Obsidian - Quick Start" -ForegroundColor Cyan Write-Host "=========================================" -ForegroundColor Cyan Write-Host "" -# Copy user's .npmrc to frontend directory if it exists and frontend/.npmrc doesn't +# Copy user's .npmrc to frontend directory if it exists $UserNpmrc = Join-Path $env:USERPROFILE ".npmrc" $FrontendNpmrc = "frontend\.npmrc" if (Test-Path $UserNpmrc) { - if (-not (Test-Path $FrontendNpmrc)) { - Write-Host "[INFO] Copying npm registry config from $UserNpmrc" -ForegroundColor Yellow - Copy-Item $UserNpmrc $FrontendNpmrc - Write-Host "[OK] Using custom npm registry configuration" -ForegroundColor Green - } else { - Write-Host "[OK] Using existing frontend\.npmrc" -ForegroundColor Green - } + Write-Host "Copying npm registry config for Docker build..." -ForegroundColor Yellow + Copy-Item $UserNpmrc $FrontendNpmrc -Force + Write-Host "[OK] Using custom npm registry configuration" -ForegroundColor Green } else { if (Test-Path $FrontendNpmrc) { - Write-Host "[OK] Using frontend\.npmrc" -ForegroundColor Green - } else { - Write-Host "[INFO] Using default npm registry (no .npmrc found)" -ForegroundColor Yellow + Remove-Item $FrontendNpmrc -Force } + Write-Host "[INFO] Using default npm registry" -ForegroundColor Yellow } Write-Host "" diff --git a/quickstart.sh b/quickstart.sh index fcc41d3..8cb54a4 100644 --- a/quickstart.sh +++ b/quickstart.sh @@ -41,8 +41,8 @@ while [[ $# -gt 0 ]]; do echo " --help Show this help message" echo "" echo "NPM Registry:" - echo " Create frontend/.npmrc to configure custom npm registry" - echo " The Docker build will use this file if present" + echo " Uses your machine's npm configuration automatically" + echo " npm install runs on host before Docker build" echo "" echo "Brings up the complete stack: database, backend API, and frontend" echo "" @@ -56,24 +56,19 @@ while [[ $# -gt 0 ]]; do esac done -# Copy user's .npmrc to frontend directory if it exists and frontend/.npmrc doesn't +# Copy user's .npmrc to frontend directory if it exists USER_NPMRC="${HOME}/.npmrc" FRONTEND_NPMRC="frontend/.npmrc" if [ -f "$USER_NPMRC" ]; then - if [ ! -f "$FRONTEND_NPMRC" ]; then - echo "ℹ Copying npm registry config from $USER_NPMRC" - cp "$USER_NPMRC" "$FRONTEND_NPMRC" - echo "✓ Using custom npm registry configuration" - else - echo "✓ Using existing frontend/.npmrc" - fi + echo "Copying npm registry config for Docker build..." + cp "$USER_NPMRC" "$FRONTEND_NPMRC" + echo "✓ Using custom npm registry configuration" else if [ -f "$FRONTEND_NPMRC" ]; then - echo "✓ Using frontend/.npmrc" - else - echo "ℹ Using default npm registry (no .npmrc found)" + rm -f "$FRONTEND_NPMRC" fi + echo "ℹ Using default npm registry" fi echo ""