-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
82 lines (75 loc) · 2.36 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
x-common-networks:
&networks
networks:
- net
x-common-restart:
&restart
restart: always
services:
backend-postgres:
<<: [ *restart, *networks ]
container_name: ${PROJECT_NAME}-postgres
hostname: ${PROJECT_NAME}-postgres
platform: linux/amd64
image: postgres:latest
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_USER_PASSWORD}
- PGDATA=/var/lib/postgresql/data
volumes:
- ./backend-db-data:/var/lib/postgresql/data
backend-redis:
<<: [ *restart, *networks ]
image: redis
container_name: ${PROJECT_NAME}-redis
hostname: ${PROJECT_NAME}-redis
backend-api:
<<: [ *restart, *networks ]
container_name: ${PROJECT_NAME}-api
hostname: ${PROJECT_NAME}-api
image: ${PROJECT_NAME}-backend:latest
platform: linux/amd64
build:
context: .
dockerfile: ./Dockerfile
volumes:
- ./backend:/app
- ./supervisord.conf:/etc/supervisor/conf.d/supervisord.conf:rw
depends_on:
- backend-postgres
command: bash docker-entrypoint.sh
environment:
- DEBUG=${DEBUG}
- API_URL=${API_URL}
- API_VERSION=${API_VERSION}
- WAIT_HOSTS=${DB_HOST}:${DB_PORT}
- WAIT_HOSTS_TIMEOUT=300
- WAIT_SLEEP_INTERVAL=15
- WAIT_HOST_CONNECT_TIMEOUT=20
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_USER_PASSWORD=${DB_USER_PASSWORD}
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- SOCIAL_GOOGLE_CLIENT_ID=${SOCIAL_GOOGLE_CLIENT_ID}
- SOCIAL_GOOGLE_CLIENT_SECRET=${SOCIAL_GOOGLE_CLIENT_SECRET}
- SOCIAL_MICROSOFT_CLIENT_ID=${SOCIAL_MICROSOFT_CLIENT_ID}
- SOCIAL_MICROSOFT_CLIENT_SECRET=${SOCIAL_MICROSOFT_CLIENT_SECRET}
backend-nginx:
<<: [ *restart, *networks ]
container_name: ${PROJECT_NAME}-nginx
image: nginx:latest
hostname: ${PROJECT_NAME}-nginx
ports:
- "${HOST_PORT}:80"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
- ./frontend:/src # 若前端爲build過的靜態檔案,則直接導入頁面位置
extra_hosts: # 若前端頁面爲前端自己建立的server則必須設定這項去讓nginx可以接同一臺機器的其他port
- "host.docker.internal:host-gateway"
networks:
net:
name: ${PROJECT_NAME}-net
driver: bridge