fix /plan
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 2m57s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 2m57s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 7s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
22
.dockerignore
Normal file
22
.dockerignore
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
**/node_modules
|
||||||
|
**/vendor
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.git
|
||||||
|
.phpunit.result.cache
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
auth.json
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
storage/app/public
|
||||||
|
storage/app/temp
|
||||||
|
storage/app/uploads
|
||||||
|
storage/debugbar
|
||||||
|
storage/framework/views/*
|
||||||
|
public/modules/*
|
||||||
|
.qodo
|
||||||
|
.camel-jbang
|
||||||
|
|
||||||
55
Dockerfile
55
Dockerfile
@@ -33,41 +33,39 @@ COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
|
|||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
# Copy ALL application files first
|
# Copy ONLY composer files first
|
||||||
COPY --chown=www-data:www-data . .
|
COPY composer.json composer.lock ./
|
||||||
|
|
||||||
# Remove any nested vendor directories
|
# Create storage and bootstrap directories needed for composer scripts
|
||||||
RUN find . -type d -name "vendor" -not -path "./vendor*" -exec rm -rf {} + 2>/dev/null || true
|
|
||||||
|
|
||||||
# Remove composer.lock to ensure fresh install
|
|
||||||
RUN rm -f composer.lock
|
|
||||||
|
|
||||||
# Create ALL storage directories BEFORE composer install
|
|
||||||
RUN mkdir -p storage/framework/cache \
|
RUN mkdir -p storage/framework/cache \
|
||||||
&& mkdir -p storage/framework/sessions \
|
&& mkdir -p storage/framework/sessions \
|
||||||
&& mkdir -p storage/framework/views \
|
&& mkdir -p storage/framework/views \
|
||||||
&& mkdir -p storage/framework/testing \
|
&& mkdir -p storage/framework/testing \
|
||||||
&& mkdir -p storage/logs \
|
&& mkdir -p storage/logs \
|
||||||
&& mkdir -p bootstrap/cache \
|
&& mkdir -p bootstrap/cache \
|
||||||
&& mkdir -p storage/framework/cache/data \
|
|
||||||
&& chmod -R 777 storage \
|
&& chmod -R 777 storage \
|
||||||
&& chmod -R 777 bootstrap/cache
|
&& chmod -R 777 bootstrap/cache
|
||||||
|
|
||||||
# Create a temporary config file to avoid cache path issues during composer
|
# Install PHP dependencies (this layer will be cached)
|
||||||
RUN if [ ! -f config/app.php ]; then \
|
RUN composer install --no-interaction --no-progress --no-scripts
|
||||||
echo "<?php return ['providers' => []];" > config/app.php; \
|
|
||||||
|
# Isolate the clean vendor directory
|
||||||
|
RUN mv vendor /vendor_clean
|
||||||
|
|
||||||
|
# Copy the rest of the application files (will ignore vendor because of .dockerignore)
|
||||||
|
COPY --chown=www-data:www-data . .
|
||||||
|
|
||||||
|
# Restore the clean vendor directory
|
||||||
|
RUN rm -rf vendor && mv /vendor_clean vendor
|
||||||
|
|
||||||
|
# Final build verification
|
||||||
|
RUN if [ ! -f vendor/laravel/prompts/src/helpers.php ]; then \
|
||||||
|
echo "ERROR: laravel/prompts/src/helpers.php missing!" && exit 1; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set environment variable for cache path
|
# Final check and debug listing
|
||||||
ENV VIEW_COMPILED_PATH=/var/www/html/storage/framework/views
|
RUN ls -l vendor/laravel/prompts/src/helpers.php \
|
||||||
|
&& du -sh vendor/laravel/prompts
|
||||||
# Install PHP dependencies
|
|
||||||
RUN composer install --no-interaction --no-progress --optimize-autoloader
|
|
||||||
|
|
||||||
# Verify critical files exist
|
|
||||||
RUN if [ ! -f vendor/laravel/framework/src/Illuminate/Foundation/resources/server.php ]; then \
|
|
||||||
echo "ERROR: server.php missing!" && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Copy package files for NPM
|
# Copy package files for NPM
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
@@ -77,17 +75,12 @@ COPY vite.config.js ./
|
|||||||
RUN npm install --legacy-peer-deps --no-audit
|
RUN npm install --legacy-peer-deps --no-audit
|
||||||
|
|
||||||
# Build Vite assets
|
# Build Vite assets
|
||||||
RUN npm run build || true
|
RUN npm run build
|
||||||
|
|
||||||
# Generate application key
|
|
||||||
RUN php artisan key:generate --no-interaction --force || true
|
|
||||||
|
|
||||||
# Cache configurations
|
|
||||||
RUN php artisan config:cache || true
|
|
||||||
|
|
||||||
|
# Copy entrypoint script and ensure it's executable
|
||||||
COPY entrypoint.sh /entrypoint.sh
|
COPY entrypoint.sh /entrypoint.sh
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
# Let the entrypoint handle artisan commands at runtime
|
||||||
EXPOSE 8000 9000
|
EXPOSE 8000 9000
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
@@ -9,6 +9,10 @@ echo "========================================"
|
|||||||
echo "Current user: $(whoami)"
|
echo "Current user: $(whoami)"
|
||||||
echo "Current directory: $(pwd)"
|
echo "Current directory: $(pwd)"
|
||||||
|
|
||||||
|
# Force debug mode for troubleshooting
|
||||||
|
export APP_DEBUG=true
|
||||||
|
export LOG_LEVEL=debug
|
||||||
|
|
||||||
# Create ALL required Laravel directories
|
# Create ALL required Laravel directories
|
||||||
echo "Creating storage directories..."
|
echo "Creating storage directories..."
|
||||||
mkdir -p storage/framework/cache
|
mkdir -p storage/framework/cache
|
||||||
@@ -54,12 +58,33 @@ EOF
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate key if not present
|
# Generate key if not present (only if APP_KEY is empty or missing)
|
||||||
if ! grep -q "APP_KEY=" .env || grep -q "APP_KEY=$" .env; then
|
echo "Checking .env for APP_KEY..."
|
||||||
|
if ! grep -E "APP_KEY=.{10,}" .env; then
|
||||||
|
echo "APP_KEY is empty or missing. Generating..."
|
||||||
echo "Generating application key..."
|
echo "Generating application key..."
|
||||||
php artisan key:generate --no-interaction --force || echo "Key generation failed"
|
# If the file doesn't have APP_KEY= at all, add it so artisan can replace it
|
||||||
|
if ! grep -q "APP_KEY=" .env; then
|
||||||
|
echo "Appending APP_KEY= placeholder..."
|
||||||
|
echo "" >> .env
|
||||||
|
echo "APP_KEY=" >> .env
|
||||||
|
fi
|
||||||
|
php artisan key:generate --no-interaction --force || echo "❌ Key generation failed!"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Verifying APP_KEY after generation:"
|
||||||
|
grep "APP_KEY" .env
|
||||||
|
|
||||||
|
# Force autoloader regeneration to ensure absolute path consistency
|
||||||
|
echo "Regenerating autoloader..."
|
||||||
|
composer dump-autoload
|
||||||
|
|
||||||
|
# Verify vendor integrity at PHP level
|
||||||
|
echo "Checking vendor visibility and READABILITY for PHP..."
|
||||||
|
ls -la /var/www/html/vendor/laravel/prompts/src/helpers.php
|
||||||
|
php -r 'if (file_exists("/var/www/html/vendor/laravel/prompts/src/helpers.php")) { echo "✅ file_exists true\n"; }'
|
||||||
|
php -r 'require "/var/www/html/vendor/laravel/prompts/src/helpers.php"; echo "✅ PHP successfully REQUIRED helpers.php\n";'
|
||||||
|
|
||||||
# Clear all caches to ensure fresh state
|
# Clear all caches to ensure fresh state
|
||||||
echo "Clearing caches..."
|
echo "Clearing caches..."
|
||||||
php artisan config:clear || true
|
php artisan config:clear || true
|
||||||
@@ -85,9 +110,9 @@ echo "========================================"
|
|||||||
|
|
||||||
# Start the application with proper error handling
|
# Start the application with proper error handling
|
||||||
if [ "$MODE" = "staging" ]; then
|
if [ "$MODE" = "staging" ]; then
|
||||||
echo "Starting PHP built-in server on port 8000..."
|
echo "Starting DIRECT PHP server on port 8000 (Bypassing artisan serve)..."
|
||||||
# Use exec with error capture
|
# Use direct php -S to eliminate any artisan wrapper issues
|
||||||
exec php artisan serve --host=0.0.0.0 --port=8000 2>&1 | tee -a /var/log/php-server.log
|
exec php -d opcache.enable=0 -S 0.0.0.0:8000 -t public server.php 2>&1 | tee -a /var/log/php-server.log
|
||||||
else
|
else
|
||||||
echo "Starting PHP-FPM on port 9000..."
|
echo "Starting PHP-FPM on port 9000..."
|
||||||
# Ensure PHP-FPM is properly configured
|
# Ensure PHP-FPM is properly configured
|
||||||
|
|||||||
21
server.php
Normal file
21
server.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Laravel - A PHP Framework For Web Artisans
|
||||||
|
*
|
||||||
|
* @package Laravel
|
||||||
|
* @author Taylor Otwell <taylor@laravel.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
$uri = urldecode(
|
||||||
|
parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
|
||||||
|
);
|
||||||
|
|
||||||
|
// This file allows us to emulate Apache's "mod_rewrite" functionality from the
|
||||||
|
// built-in PHP web server. This provides a convenient way to test a Laravel
|
||||||
|
// application without having installed a "real" web server software here.
|
||||||
|
if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once __DIR__.'/public/index.php';
|
||||||
Reference in New Issue
Block a user