mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 09:13:08 +00:00
fix: run npm install as root to avoid permission issues
The named Docker volume for node_modules is created with root ownership, causing EACCES errors when npm tries to write as the automaker user. Solution: - Run npm ci as root (installation phase) - Use --legacy-peer-deps to properly handle optional dependencies - Fix permissions after install - Run server process as automaker user for security This eliminates permission denied errors during npm install in dev containers.
This commit is contained in:
@@ -74,23 +74,16 @@ services:
|
|||||||
command:
|
command:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
# Fix permissions on node_modules (created as root by Docker volume)
|
# Install as root to avoid permission issues with named volumes
|
||||||
echo 'Fixing node_modules permissions...'
|
echo 'Installing dependencies...' &&
|
||||||
rm -rf /app/node_modules 2>/dev/null || true
|
npm ci --legacy-peer-deps &&
|
||||||
rm -rf /app/apps/ui/node_modules 2>/dev/null || true
|
echo 'Building shared packages...' &&
|
||||||
mkdir -p /app/node_modules
|
npm run build:packages &&
|
||||||
chown -R automaker:automaker /app/node_modules
|
|
||||||
chmod -R u+rwX /app/node_modules
|
|
||||||
|
|
||||||
# Run the rest as automaker user
|
# Fix permissions and start server as automaker user
|
||||||
exec gosu automaker sh -c "
|
chown -R automaker:automaker /app/node_modules &&
|
||||||
echo 'Installing dependencies...' &&
|
echo 'Starting server in development mode...' &&
|
||||||
npm ci --force &&
|
exec gosu automaker npm run _dev:server
|
||||||
echo 'Building shared packages...' &&
|
|
||||||
npm run build:packages &&
|
|
||||||
echo 'Starting server in development mode...' &&
|
|
||||||
npm run _dev:server
|
|
||||||
"
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'curl', '-f', 'http://localhost:3008/api/health']
|
test: ['CMD', 'curl', '-f', 'http://localhost:3008/api/health']
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|||||||
@@ -75,23 +75,16 @@ services:
|
|||||||
command:
|
command:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
# Fix permissions on node_modules (created as root by Docker volume)
|
# Install as root to avoid permission issues with named volumes
|
||||||
echo 'Fixing node_modules permissions...'
|
echo 'Installing dependencies...' &&
|
||||||
rm -rf /app/node_modules 2>/dev/null || true
|
npm ci --legacy-peer-deps &&
|
||||||
rm -rf /app/apps/ui/node_modules 2>/dev/null || true
|
echo 'Building shared packages...' &&
|
||||||
mkdir -p /app/node_modules
|
npm run build:packages &&
|
||||||
chown -R automaker:automaker /app/node_modules
|
|
||||||
chmod -R u+rwX /app/node_modules
|
|
||||||
|
|
||||||
# Run the rest as automaker user
|
# Fix permissions and start server as automaker user
|
||||||
exec gosu automaker sh -c "
|
chown -R automaker:automaker /app/node_modules &&
|
||||||
echo 'Installing dependencies...' &&
|
echo 'Starting server in development mode...' &&
|
||||||
npm ci --force &&
|
exec gosu automaker npm run _dev:server
|
||||||
echo 'Building shared packages...' &&
|
|
||||||
npm run build:packages &&
|
|
||||||
echo 'Starting server in development mode...' &&
|
|
||||||
npm run _dev:server
|
|
||||||
"
|
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ['CMD', 'curl', '-f', 'http://localhost:3008/api/health']
|
test: ['CMD', 'curl', '-f', 'http://localhost:3008/api/health']
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
|||||||
Reference in New Issue
Block a user