Files
nlcc-itinerary/docker-entrypoint.sh
Joshua Ryder 514c72a4fa fix: Resolve Docker volume permissions for SQLite database
Fixed SQLITE_READONLY errors by implementing proper volume permission
handling in Docker container. The issue occurred because Docker volumes
are mounted with root ownership, preventing the non-root nuxt user from
writing to the database.

Solution:
- Added docker-entrypoint.sh script to handle permission fixes
- Container starts as root to fix /app/data permissions
- Uses su-exec to drop privileges to nuxt user after fixing permissions
- Maintains security by running application as non-root user

This allows the SQLite database to be properly created and modified
while keeping the container secure with non-root execution.

Fixes:
- "attempt to write a readonly database" errors
- Session cleanup failures
- Rate limit cleanup failures
- Password reset cleanup failures
- Admin credential generation on first launch

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-06 08:16:41 -05:00

18 lines
408 B
Bash

#!/bin/sh
set -e
# Ensure data directory exists and has correct permissions
# This is needed because Docker volumes may be mounted with root ownership
if [ ! -d /app/data ]; then
mkdir -p /app/data
fi
# If running as root, fix permissions and switch to nuxt user
if [ "$(id -u)" = "0" ]; then
chown -R nuxt:nodejs /app/data
exec su-exec nuxt "$@"
else
# Already running as nuxt user
exec "$@"
fi