-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
compose.yaml
108 lines (102 loc) · 2.1 KB
/
compose.yaml
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
104
105
106
107
108
---
services:
nginx:
image: jonasal/nginx-certbot:5.2.1-nginx1.27.0
restart: always
ports:
- 80:80
- 443:443
env_file:
- ./nginx-certbot.env
configs:
- source: myapp_config
target: /etc/nginx/user_conf.d/myapp.conf
networks:
- public
volumes:
- nginx_secrets:/etc/letsencrypt
depends_on:
flask:
condition: service_healthy
restart: true
flask:
image: aputra/flask:latest
restart: always
build:
context: flask
dockerfile: Dockerfile
# ports:
# - 7070:8080
env_file:
- ./flask/dev.env
secrets:
- api_key
- source: api_key
target: /api_key.txt
configs:
- source: my_config
target: /config-dev-v2.yaml
environment:
- APP_VERSION=0.1.0
# - DB_PASSWORD
- APP_TOKEN=${APP_TOKEN}
- FLASK_DEBUG=1
- FLASK_APP=./app.py
- DB_HOST=postgres
- DB_DATABASE=mydb
- DB_USER=myuser
volumes:
- ./flask/config-dev.yaml:/config-dev.yaml
# - ./flask/my-data:/data
- flask-data:/data
- ./flask:/app
networks:
- private
- public
depends_on:
- postgres
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/about"]
interval: 5s
retries: 5
start_period: 15s
timeout: 5s
postgres:
image: postgres:16.3
restart: always
# ports:
# - 5432:5432
environment:
POSTGRES_USER: myuser
POSTGRES_DB: mydb
POSTGRES_PASSWORD_FILE: /run/secrets/pg_password
secrets:
- pg_password
volumes:
- postgres-data:/var/lib/postgresql/data
networks:
- private
secrets:
api_key:
file: ./flask/api_key.txt
pg_password:
file: ./pg_password.txt
configs:
my_config:
file: ./flask/config-dev.yaml
# nginx_config:
# file: ./nginx.conf
myapp_config:
file: ./myapp.conf
volumes:
flask-data:
postgres-data:
nginx_secrets:
networks:
public:
private:
driver: bridge
ipam:
config:
- subnet: "10.0.0.0/19"
gateway: "10.0.0.1"