From dc5089c0118cd7468454c4291253f04197d0ff42 Mon Sep 17 00:00:00 2001 From: Daniel Arroyo Date: Tue, 24 Mar 2026 15:19:21 -0300 Subject: [PATCH] fix: Make entrypoint more robust to handle volume permission issues --- docker-entrypoint.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index 61730ad..590a487 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -3,14 +3,28 @@ set -e cd /app -# Initialize database if it doesn't exist or schema changed echo "Checking database..." # Ensure data directory exists with proper permissions mkdir -p /app/data +chmod 777 /app/data + +# Create a dummy file to test write access +touch /app/data/.write_test 2>/dev/null && rm /app/data/.write_test || { + echo "Warning: Cannot write to /app/data, trying to fix permissions..." + chmod -R 777 /app/data +} # Use local prisma version from node_modules (skip generate - already built) -./node_modules/prisma/build/index.js db push --skip-generate +./node_modules/prisma/build/index.js db push --skip-generate || { + echo "Warning: db push failed, checking if database exists..." + if [ -f /app/data/dev.db ]; then + echo "Database file exists, continuing..." + else + echo "Database file does not exist and could not be created" + exit 1 + fi +} echo "Starting application..." exec "$@"