Scope npm install lock to bootstrap phase only
This commit is contained in:
@@ -6,7 +6,6 @@ cd "$(dirname "$0")/.."
|
|||||||
# Serialize dependency install when multiple containers share the same workspace.
|
# Serialize dependency install when multiple containers share the same workspace.
|
||||||
LOCK_FILE=/app/Frontend/.npm-install.lock
|
LOCK_FILE=/app/Frontend/.npm-install.lock
|
||||||
exec 9>"$LOCK_FILE"
|
exec 9>"$LOCK_FILE"
|
||||||
flock 9
|
|
||||||
|
|
||||||
# Prevent path leakage between host Nuxt build cache and Docker runtime.
|
# Prevent path leakage between host Nuxt build cache and Docker runtime.
|
||||||
# If any cache contains absolute /Users/... imports, Nitro dev runtime can break in /app.
|
# If any cache contains absolute /Users/... imports, Nitro dev runtime can break in /app.
|
||||||
@@ -15,6 +14,10 @@ find .nuxt -mindepth 1 -maxdepth 1 -exec rm -rf {} + || true
|
|||||||
find .output -mindepth 1 -maxdepth 1 -exec rm -rf {} + || true
|
find .output -mindepth 1 -maxdepth 1 -exec rm -rf {} + || true
|
||||||
rm -rf node_modules/.cache node_modules/.vite
|
rm -rf node_modules/.cache node_modules/.vite
|
||||||
|
|
||||||
|
# Only installation steps are serialized; runtime must not hold the lock.
|
||||||
|
(
|
||||||
|
flock 9
|
||||||
|
|
||||||
# Install deps (container starts from a clean image).
|
# Install deps (container starts from a clean image).
|
||||||
# This workspace has mixed Apollo/Nuxt peer graphs; keep install deterministic in Docker.
|
# This workspace has mixed Apollo/Nuxt peer graphs; keep install deterministic in Docker.
|
||||||
npm install --legacy-peer-deps
|
npm install --legacy-peer-deps
|
||||||
@@ -33,6 +36,7 @@ elif [ "$ARCH" = "x86_64" ] || [ "$ARCH" = "amd64" ]; then
|
|||||||
else
|
else
|
||||||
npm rebuild sharp || true
|
npm rebuild sharp || true
|
||||||
fi
|
fi
|
||||||
|
)
|
||||||
|
|
||||||
# Wait until PostgreSQL is reachable before applying schema.
|
# Wait until PostgreSQL is reachable before applying schema.
|
||||||
until node -e "const u=new URL(process.env.DATABASE_URL||''); const net=require('net'); const s=net.createConnection({host:u.hostname,port:Number(u.port||5432)}); s.on('connect',()=>{s.end(); process.exit(0);}); s.on('error',()=>process.exit(1)); setTimeout(()=>process.exit(1), 1000);" ; do
|
until node -e "const u=new URL(process.env.DATABASE_URL||''); const net=require('net'); const s=net.createConnection({host:u.hostname,port:Number(u.port||5432)}); s.on('connect',()=>{s.end(); process.exit(0);}); s.on('error',()=>process.exit(1)); setTimeout(()=>process.exit(1), 1000);" ; do
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ cd "$(dirname "$0")/.."
|
|||||||
# Serialize dependency install when multiple containers share the same workspace.
|
# Serialize dependency install when multiple containers share the same workspace.
|
||||||
LOCK_FILE=/app/Frontend/.npm-install.lock
|
LOCK_FILE=/app/Frontend/.npm-install.lock
|
||||||
exec 9>"$LOCK_FILE"
|
exec 9>"$LOCK_FILE"
|
||||||
|
|
||||||
|
# Only dependency bootstrap is serialized; worker runtime must not hold the lock.
|
||||||
|
(
|
||||||
flock 9
|
flock 9
|
||||||
|
|
||||||
# Worker container starts from clean image.
|
# Worker container starts from clean image.
|
||||||
@@ -24,6 +27,7 @@ else
|
|||||||
npm rebuild sharp || true
|
npm rebuild sharp || true
|
||||||
fi
|
fi
|
||||||
npx prisma generate
|
npx prisma generate
|
||||||
|
)
|
||||||
|
|
||||||
# Ensure DB is reachable before the worker starts consuming jobs.
|
# Ensure DB is reachable before the worker starts consuming jobs.
|
||||||
until node -e "const u=new URL(process.env.DATABASE_URL||''); const net=require('net'); const s=net.createConnection({host:u.hostname,port:Number(u.port||5432)}); s.on('connect',()=>{s.end(); process.exit(0);}); s.on('error',()=>process.exit(1)); setTimeout(()=>process.exit(1), 1000);" ; do
|
until node -e "const u=new URL(process.env.DATABASE_URL||''); const net=require('net'); const s=net.createConnection({host:u.hostname,port:Number(u.port||5432)}); s.on('connect',()=>{s.end(); process.exit(0);}); s.on('error',()=>process.exit(1)); setTimeout(()=>process.exit(1), 1000);" ; do
|
||||||
|
|||||||
Reference in New Issue
Block a user