edit docker-compose and Dockerfile

This commit is contained in:
armiejean 2025-03-22 14:03:33 +08:00
parent f4af11e02e
commit cafd4888a0
15 changed files with 26 additions and 16 deletions

View File

@ -1,18 +1,28 @@
FROM php:8.1-fpm
FROM php:8.2-fpm
# Set working directory
WORKDIR /var/www/html
# Install system dependencies
RUN apt-get update && apt-get install -y \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
zip \
unzip \
&& docker-php-ext-configure gd \
&& docker-php-ext-install gd pdo pdo_mysql
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install gd pdo pdo_mysql bcmath opcache zip
# Copy application files
COPY . .
RUN chown -R www-data:www-data /var/www/html
# Set proper permissions
RUN chown -R www-data:www-data /var/www/html \
&& chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
CMD php artisan migrate --force && php-fpm
# Set entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

0
bootstrap/cache/.gitignore vendored Normal file → Executable file
View File

View File

@ -11,14 +11,14 @@ services:
mysql:
condition: service_healthy
volumes:
- .:/var/www
- .:/var/www/html
environment:
- DB_HOST=mysql
- DB_DATABASE=laravel
- DB_USERNAME=root
- DB_PASSWORD=root
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
test: ["CMD", "php", "-v"]
interval: 20s
timeout: 10s
retries: 5
@ -35,7 +35,7 @@ services:
ports:
- "3307:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--password=root"]
interval: 10s
timeout: 5s
retries: 3
@ -51,7 +51,7 @@ services:
condition: service_healthy
volumes:
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
- .:/var/www
- .:/var/www/html
ports:
- "80:80"
networks:

7
entrypoint.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/sh
# Run migrations
php artisan migrate --force
# Start PHP-FPM
exec php-fpm

7
package-lock.json generated
View File

@ -1,7 +0,0 @@
{
"name": "laravel",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

0
storage/app/.gitignore vendored Normal file → Executable file
View File

0
storage/app/private/.gitignore vendored Normal file → Executable file
View File

0
storage/app/public/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/cache/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/cache/data/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/sessions/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/testing/.gitignore vendored Normal file → Executable file
View File

0
storage/framework/views/.gitignore vendored Normal file → Executable file
View File

0
storage/logs/.gitignore vendored Normal file → Executable file
View File