fix: Make entrypoint more robust to handle volume permission issues #20
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user