/
docker-compose.yml
109 lines (109 loc) · 2.83 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
104
105
106
107
108
109
version: "3"
services:
api:
build:
context: ./api
dockerfile: Dockerfile
command: uvicorn app.main:app --host 0.0.0.0 --port 80 --root-path /api
depends_on:
db:
condition: service_healthy
environment:
- DB_HOST=${DB_HOST}
- DB_PASSWORD=${DB_PASSWORD}
- DB_PORT=${DB_PORT}
- DB_SCHEMA=${DB_SCHEMA}
- DB_USER=${DB_USER}
labels:
- traefik.enable=true
- traefik.http.routers.api.entrypoints=http
- traefik.http.routers.api.priority=10
- traefik.http.routers.api.rule=PathPrefix(`/api`)
- traefik.http.routers.api.service=api
- traefik.http.routers.api.middlewares=api@docker
- traefik.http.middlewares.api.stripPrefix.prefixes=/api
- traefik.http.services.api.loadBalancer.server.port=80
networks:
- backend
restart: unless-stopped
volumes:
- ./api/app:/app:ro
db:
image: postgres:latest
command: >
postgres
-c listen_addresses='*'
# -c log_destination=stderr
# -c log_statement=all
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 10s
timeout: 5s
retries: 2
labels:
- traefik.enable=false
networks:
- backend
ports:
- 5432:5432
restart: unless-stopped
volumes:
- ./data:/var/lib/postgresql/data:rw
scraper:
build:
context: ./utils
dockerfile: Dockerfile
depends_on:
- traefik
environment:
- API_HOST=${API_HOST}
- TWITTER_ACCESS_TOKEN_SECRET=${TWITTER_ACCESS_TOKEN_SECRET}
- TWITTER_ACCESS_TOKEN=${TWITTER_ACCESS_TOKEN}
- TWITTER_CONSUMER_KEY=${TWITTER_CONSUMER_KEY}
- TWITTER_CONSUMER_SECRET=${TWITTER_CONSUMER_SECRET}
labels:
- traefik.enable=false
networks:
- backend
restart: unless-stopped
volumes:
- ./utils:/app:ro
traefik:
image: traefik:latest
command: traefik --providers.docker.exposedByDefault=false
depends_on:
- api
- web
networks:
- backend
- frontend
ports:
- 80:80
- 8080:8080
restart: unless-stopped
volumes:
- ./server/traefik.yml:/etc/traefik/traefik.yml:ro
- /var/run/docker.sock:/var/run/docker.sock:ro
web:
image: nginx:latest
command: ["/usr/sbin/nginx", "-g", "daemon off;"]
depends_on:
- api
labels:
- traefik.enable=true
- traefik.http.routers.web.entrypoints=http
- traefik.http.routers.web.priority=1
- traefik.http.routers.web.rule=PathPrefix(`/`)
networks:
- backend
restart: unless-stopped
volumes:
- ./server/default.conf:/etc/nginx/conf.d/default.conf:ro
- ./web/build:/usr/share/nginx/html:ro
networks:
backend:
frontend:
external: true