reconfigure

This commit is contained in:
root 2025-03-27 13:59:01 +08:00
parent 6bc8bfb329
commit 54c1b5554e
3 changed files with 17 additions and 6 deletions

View File

@ -8,7 +8,8 @@ RUN apt-get update && apt-get install -y \
libxml2-dev \ libxml2-dev \
zip \ zip \
unzip \ unzip \
procps procps \
mariadb-client
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
@ -21,7 +22,6 @@ RUN composer install --no-scripts --no-interaction
RUN chown -R www-data:www-data /var/www/html RUN chown -R www-data:www-data /var/www/html
RUN chmod -R 775 /var/www/html/storage RUN chmod -R 775 /var/www/html/storage
# Install PDO MySQL (Fix for "Could not find driver" error)
RUN docker-php-ext-install pdo pdo_mysql RUN docker-php-ext-install pdo pdo_mysql
COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh

View File

@ -7,10 +7,10 @@ services:
volumes: volumes:
- mysql-data:/var/lib/mysql - mysql-data:/var/lib/mysql
healthcheck: healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", "-prootpassword"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 10
restart: unless-stopped restart: unless-stopped
laravel: laravel:
@ -41,7 +41,7 @@ services:
laravel: laravel:
condition: service_healthy condition: service_healthy
ports: ports:
- "8080:80" - "80:80" # Changed from 8080 to 80
volumes: volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf - ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./laravel:/var/www/html - ./laravel:/var/www/html

View File

@ -1,8 +1,19 @@
#!/bin/bash #!/bin/bash
# Fix ownership and permissions for storage directories set -e
# Fix ownership and permissions
chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache
chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
# Wait for MySQL to be ready
echo "Waiting for MySQL to be ready..."
while ! mysqladmin ping -h"mysql" -u"root" -p"rootpassword" --silent; do
sleep 1
done
echo "MySQL is ready!"
# Run migrations # Run migrations
php artisan migrate --force php artisan migrate --force
# Start PHP-FPM # Start PHP-FPM
exec "$@" exec "$@"