-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
docker-compose.yml
79 lines (76 loc) · 2.38 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
name: pyronear
services:
db:
image: postgres:15-alpine
expose:
- 5432
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
volumes:
- postgres_data:/var/lib/postgresql/data/
healthcheck:
test: ["CMD-SHELL", "sh -c 'pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}'"]
interval: 10s
timeout: 3s
retries: 3
# ref link: https://github.com/localstack/localstack/blob/master/docker-compose.yml
localstack:
image: localstack/localstack:1.4.0
ports:
- 4566:4566
# environment variables details: https://docs.localstack.cloud/references/configuration/
environment:
- EDGE_PORT=4566
- SERVICES=s3
- DATA_DIR=/tmp/localstack/data
- AWS_DEFAULT_REGION=${S3_REGION:-us-east-1}
volumes:
- ./scripts/localstack:/etc/localstack/init/ready.d
- localstack_data:/tmp/localstack
healthcheck:
test: ["CMD-SHELL", "awslocal --endpoint-url=http://localhost:4566 s3 ls s3://admin"]
interval: 10s
timeout: 5s
retries: 10
backend:
image: pyronear/alert-api:latest
build:
context: .
dockerfile: ./src/Dockerfile
depends_on:
db:
condition: service_healthy
localstack:
condition: service_healthy
ports:
- "5050:5050"
environment:
- POSTGRES_URL=postgresql+asyncpg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db/${POSTGRES_DB}
- SUPERADMIN_LOGIN=${SUPERADMIN_LOGIN}
- SUPERADMIN_PWD=${SUPERADMIN_PWD}
- SUPERADMIN_ORG=${SUPERADMIN_ORG}
- JWT_SECRET=${JWT_SECRET}
- SUPPORT_EMAIL=${SUPPORT_EMAIL}
- DEBUG=true
- PROMETHEUS_ENABLED=true
- SQLALCHEMY_SILENCE_UBER_WARNING=1
- S3_ENDPOINT_URL=${S3_ENDPOINT_URL:-http://localstack:4566}
- S3_ACCESS_KEY=${S3_ACCESS_KEY:-na}
- S3_SECRET_KEY=${S3_SECRET_KEY:-na}
- S3_REGION=${S3_REGION:-us-east-1}
- S3_PROXY_URL=${S3_PROXY_URL}
- SERVER_NAME=${SERVER_NAME}
volumes:
- ./src/:/app/
command: "sh -c 'alembic upgrade head && python app/db.py && uvicorn app.main:app --reload --host 0.0.0.0 --port 5050 --proxy-headers'"
restart: always
healthcheck:
test: ["CMD-SHELL", "curl http://localhost:5050/status"]
interval: 10s
timeout: 3s
retries: 3
volumes:
postgres_data:
localstack_data: