-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathdocker-compose.yml
42 lines (40 loc) · 1.08 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
services:
postgres:
platform: linux/amd64
image: postgres:14.5
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- "5432:5432"
api:
build:
context: .
dockerfile: Dockerfile
container_name: nowcasting_api
command: bash -c "sleep 2
&& apt-get update
&& apt-get install -y cron
&& cron
&& sleep 2
&& python script/fake_data.py
&& uvicorn nowcasting_api.main:app --reload --host 0.0.0.0 --port 8000"
ports:
- "8000:8000"
environment:
- DB_URL=postgresql://postgres:postgres@postgres:5432/postgres
volumes:
- ./nowcasting_api/:/app/nowcasting_api
- ./script/:/app/script
working_dir: /app
configs:
- source: crontab
target: /etc/cron.d/crontab
mode: 0644
depends_on:
- "postgres"
configs:
crontab:
content: |
*/15 * * * * root PYTHONPATH=/app DB_URL=postgresql://postgres:postgres@postgres:5432/postgres /usr/local/bin/python -m script.fake_data > /proc/1/fd/1 2>/proc/1/fd/2