-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
103 lines (98 loc) · 2.17 KB
/
docker-compose.yml
File metadata and controls
103 lines (98 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
services:
# Laravel Backend
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: laravel-backend
restart: unless-stopped
volumes:
- ./backend:/var/www/html
- backend_vendor:/var/www/html/vendor
environment:
- APP_ENV=local
- APP_DEBUG=true
- DB_CONNECTION=pgsql
- DB_HOST=db
- DB_PORT=5432
- DB_DATABASE=laravel
- DB_USERNAME=laravel
- DB_PASSWORD=password
networks:
- app-network
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "php artisan --version >/dev/null 2>&1 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
# Nginx for Laravel
nginx:
image: nginx:alpine
container_name: laravel-nginx
restart: unless-stopped
ports:
- "8000:80"
volumes:
- ./backend:/var/www/html
- ./docker/nginx/conf.d:/etc/nginx/conf.d
networks:
- app-network
depends_on:
- backend
# Database
db:
image: postgres:15
container_name: laravel-db
restart: unless-stopped
environment:
POSTGRES_DB: laravel
POSTGRES_USER: laravel
POSTGRES_PASSWORD: password
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- dbdata:/var/lib/postgresql/data
networks:
- app-network
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U laravel -d laravel"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
# React Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: react-frontend
restart: unless-stopped
volumes:
- ./frontend:/app
- /app/node_modules
ports:
- "3000:3000"
networks:
- app-network
depends_on:
backend:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:3000 || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
app-network:
driver: bridge
volumes:
dbdata:
driver: local
backend_vendor:
driver: local