31 lines
817 B
Bash
31 lines
817 B
Bash
#!/bin/bash
|
|
set -e
|
|
|
|
cd /app
|
|
|
|
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 || {
|
|
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 "$@"
|