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
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
libpng-dev \
|
libpng-dev \
|
||||||
libjpeg-dev \
|
libjpeg-dev \
|
||||||
libfreetype6-dev \
|
libfreetype6-dev \
|
||||||
|
libzip-dev \
|
||||||
zip \
|
zip \
|
||||||
unzip \
|
unzip \
|
||||||
&& docker-php-ext-configure gd \
|
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||||
&& docker-php-ext-install gd pdo pdo_mysql
|
&& docker-php-ext-install gd pdo pdo_mysql bcmath opcache zip
|
||||||
|
|
||||||
|
# Copy application files
|
||||||
COPY . .
|
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:
|
mysql:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
volumes:
|
volumes:
|
||||||
- .:/var/www
|
- .:/var/www/html
|
||||||
environment:
|
environment:
|
||||||
- DB_HOST=mysql
|
- DB_HOST=mysql
|
||||||
- DB_DATABASE=laravel
|
- DB_DATABASE=laravel
|
||||||
- DB_USERNAME=root
|
- DB_USERNAME=root
|
||||||
- DB_PASSWORD=root
|
- DB_PASSWORD=root
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-f", "http://localhost"]
|
test: ["CMD", "php", "-v"]
|
||||||
interval: 20s
|
interval: 20s
|
||||||
timeout: 10s
|
timeout: 10s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
@ -35,7 +35,7 @@ services:
|
||||||
ports:
|
ports:
|
||||||
- "3307:3306"
|
- "3307:3306"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--password=root"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 3
|
retries: 3
|
||||||
|
@ -51,7 +51,7 @@ services:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
volumes:
|
volumes:
|
||||||
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
||||||
- .:/var/www
|
- .:/var/www/html
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
networks:
|
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