62 lines
1.2 KiB
YAML
62 lines
1.2 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
app:
|
|
container_name: laravel-app
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
restart: unless-stopped
|
|
depends_on:
|
|
mysql:
|
|
condition: service_healthy
|
|
volumes:
|
|
- .:/var/www
|
|
environment:
|
|
- DB_HOST=mysql
|
|
- DB_DATABASE=laravel
|
|
- DB_USERNAME=root
|
|
- DB_PASSWORD=root
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost"]
|
|
interval: 20s
|
|
timeout: 10s
|
|
retries: 5
|
|
networks:
|
|
- laravel
|
|
|
|
mysql:
|
|
image: mysql:8.0
|
|
container_name: mysql-db
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: root
|
|
MYSQL_DATABASE: laravel
|
|
ports:
|
|
- "3307:3306"
|
|
healthcheck:
|
|
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
networks:
|
|
- laravel
|
|
|
|
nginx:
|
|
image: nginx:latest
|
|
container_name: nginx-webserver
|
|
restart: unless-stopped
|
|
depends_on:
|
|
app:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
|
|
- .:/var/www
|
|
ports:
|
|
- "80:80"
|
|
networks:
|
|
- laravel
|
|
|
|
networks:
|
|
laravel:
|
|
driver: bridge |