Merge pull request 'fix: Make entrypoint more robust to handle volume permission issues' (#20) from develop into main
Reviewed-on: #20
This commit was merged in pull request #20.
This commit is contained in:
@@ -3,14 +3,28 @@ set -e
|
|||||||
|
|
||||||
cd /app
|
cd /app
|
||||||
|
|
||||||
# Initialize database if it doesn't exist or schema changed
|
|
||||||
echo "Checking database..."
|
echo "Checking database..."
|
||||||
|
|
||||||
# Ensure data directory exists with proper permissions
|
# Ensure data directory exists with proper permissions
|
||||||
mkdir -p /app/data
|
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)
|
# 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..."
|
echo "Starting application..."
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|||||||
Reference in New Issue
Block a user