Fix: Resolve permission issues with .storage directories
- Install su-exec in Dockerfile for user switching - Modified start.sh to create directories as root, then change ownership - Container starts as root but switches to nextjs user for app execution - This prevents permission denied errors when creating .storage directories
This commit is contained in:
9
start.sh
9
start.sh
@@ -1,11 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Create .storage directories if they don't exist
|
||||
# Create .storage directories if they don't exist (as root)
|
||||
mkdir -p /app/.storage/users
|
||||
mkdir -p /app/.storage/bookings
|
||||
mkdir -p /app/.storage/treatments
|
||||
mkdir -p /app/.storage/availability
|
||||
mkdir -p /app/.storage/cancellation-tokens
|
||||
|
||||
# Start the application
|
||||
exec node server-dist/index.js
|
||||
# Change ownership to nextjs user
|
||||
chown -R nextjs:nodejs /app/.storage
|
||||
|
||||
# Start the application as nextjs user
|
||||
exec su-exec nextjs node server-dist/index.js
|
||||
|
Reference in New Issue
Block a user