-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
85 lines (83 loc) · 2.05 KB
/
docker-compose.yml
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
volumes:
db:
name: db-${TAG}
networks:
healthcheck:
name: healthcheck-${TAG}
services:
backend:
container_name: backend-${TAG:-prod}
image: pierrecastro/healthcheck-backend:${TAG}
build: ./backend
networks:
- healthcheck
environment:
- DATABASE_HOST
- DATABASE_PORT
- DATABASE_USERNAME
- DATABASE_PASSWORD
- DATABASE_NAME
- JWT_SECRET_KEY
- STRIPE_SECRET_KEY
healthcheck:
test: 'curl --fail --request POST --header ''content-type: application/json'' --url ''http://localhost:4000'' --data ''{"query":"query { __typename }"}'''
interval: 1s
timeout: 2s
retries: 30
depends_on:
db:
condition: service_healthy
frontend:
container_name: frontend-${TAG}
image: pierrecastro/healthcheck-frontend:${TAG}
build: ./frontend
networks:
- healthcheck
depends_on:
backend:
condition: service_healthy
healthcheck:
test: "curl --fail --request GET --url 'http://localhost:5173'"
interval: 1s
timeout: 2s
retries: 30
volumes:
- ./frontend/src:/app/src
- /app/node_modules
db:
container_name: db-${TAG}
image: postgres:16.4
networks:
- healthcheck
healthcheck:
test: ["CMD-SHELL", "pg_isready -d postgres -U postgres"]
interval: 1s
timeout: 2s
retries: 30
environment:
- DATABASE_NAME
- POSTGRES_USER=${DATABASE_USERNAME}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD}
volumes:
- db:/var/lib/postgresql/data
- ./db-init.sh:/docker-entrypoint-initdb.d/db-init.sh
adminer:
image: adminer
container_name: adminer-${TAG}
networks:
- healthcheck
apigateway:
container_name: apigateway-${TAG}
image: nginx:1.21.3
networks:
- healthcheck
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./logs-${TAG}:/var/log/nginx
depends_on:
backend:
condition: service_healthy
frontend:
condition: service_healthy
ports:
- ${GATEWAY_PORT}:80