fix dockerfile
All checks were successful
Build, Push and Deploy / build-and-deploy (push) Successful in 2m29s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s

This commit is contained in:
eko
2026-03-16 10:20:15 +07:00
parent d8a12dbcc2
commit fc0669d58e
2 changed files with 60 additions and 19 deletions

56
entrypoint.sh Normal file
View File

@@ -0,0 +1,56 @@
#!/bin/sh
set -e
echo "========================================"
echo "Starting container setup..."
echo "========================================"
# Show current user
echo "Current user: $(whoami)"
echo "Current directory: $(pwd)"
# Create directories one by one with error checking
echo "Creating storage directories..."
mkdir -p storage/framework/cache || { echo "Failed to create cache dir"; exit 1; }
mkdir -p storage/framework/sessions || { echo "Failed to create sessions dir"; exit 1; }
mkdir -p storage/framework/views || { echo "Failed to create views dir"; exit 1; }
mkdir -p storage/logs || { echo "Failed to create logs dir"; exit 1; }
mkdir -p bootstrap/cache || { echo "Failed to create bootstrap cache dir"; exit 1; }
# Set permissions
echo "Setting permissions..."
chmod -R 777 storage || { echo "Failed to set storage permissions"; exit 1; }
chmod -R 777 bootstrap/cache || { echo "Failed to set bootstrap permissions"; exit 1; }
# Verify directories
echo "Verifying directories..."
ls -la storage/framework/
ls -la bootstrap/
# Check if .env exists
if [ ! -f .env ]; then
echo "WARNING: .env file not found!"
cp .env.example .env 2>/dev/null || echo "APP_ENV=production" > .env
fi
# Generate key
echo "Generating application key..."
php artisan key:generate --no-interaction --force || echo "Key generation failed"
# Clear cache
echo "Clearing cache..."
php artisan config:clear || true
php artisan cache:clear || true
echo "========================================"
echo "Setup complete. Starting application..."
echo "========================================"
# Start the application
if [ "$MODE" = "dev" ]; then
echo "Starting PHP built-in server on port 8000..."
exec php artisan serve --host=0.0.0.0 --port=8000
else
echo "Starting PHP-FPM on port 9000..."
exec php-fpm
fi