edit docker-compose and Dockerfile
This commit is contained in:
parent
f4af11e02e
commit
cafd4888a0
20
Dockerfile
20
Dockerfile
|
@ -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"]
|
|
@ -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:
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Run migrations
|
||||
php artisan migrate --force
|
||||
|
||||
# Start PHP-FPM
|
||||
exec php-fpm
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"name": "laravel",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
|
||||
}
|
Loading…
Reference in New Issue