-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
103 lines (103 loc) · 2.66 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
version: "3.9"
services:
test-client:
build: test-client
image: 50012-lab1-test-client
volumes:
- type: volume
source: nginx-logs
target: /var/log/nginx
- type: volume
source: fastapi-logs
target: /var/log/fastapi/
- type: bind
source: ./nginx-server/html
target: /var/html
read_only: true
- type: bind
source: ./test-client/result
target: /var/log/pytest
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- PROXY_HOST=proxy
- PROXY_PORT=8080
# Run basic tests only
- PYTEST_TESTS=basic_test.py
# Run smoke tests only
# - PYTEST_TESTS=smoke_test.py
# Default test options
# - PYTEST_ADDOPTS=-rA --tb=short
# Shorter version for basic tests, only sample a subset of static files
- PYTEST_ADDOPTS=-rA --tb=short --proxytest-nginx-static-files-n-samples=3
depends_on:
- proxy
- fastapi-server
- nginx-server
restart: "no"
stop_grace_period: "1s"
proxy:
build: proxy
image: 50012-lab1-test-proxy
volumes:
- type: bind
source: ./proxy/app
target: /app
- type: bind
source: ./proxy/logs
target: /var/log/proxy/
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
depends_on:
- nginx-server
ports:
- "8080:8080"
- "3000:3000"
stop_grace_period: "3s"
proxy-wireshark:
image: linuxserver/wireshark
network_mode: "service:proxy"
cap_add:
- NET_ADMIN
environment:
- PUID=1000
- PGID=1000
- TZ=Asia/Singapore
depends_on:
- proxy
nginx-server:
image: openresty/openresty
volumes:
- type: bind
source: nginx-server/html
target: /usr/local/openresty/nginx/html
read_only: true
- type: bind
source: ./nginx-server/default.conf
target: /etc/nginx/conf.d/default.conf
read_only: true
- type: volume
source: nginx-logs
target: /var/log/nginx/
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "8000:80"
fastapi-server:
build: fastapi-server
image: 50012-lab1-fastapi-server
command: uvicorn app.main:app --host 0.0.0.0 --port 80 --reload
environment:
DEBUG: 1
volumes:
- ./fastapi-server/app:/code/app
- type: volume
source: fastapi-logs
target: /var/log/fastapi/
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
volumes:
nginx-logs:
name: nginx-logs
fastapi-logs:
name: fastapi-logs