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:
2025-10-01 23:07:33 +02:00
parent 857b60e1f5
commit ffc21a76e7
2 changed files with 13 additions and 7 deletions

View File

@@ -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