Skip to content

Commit 08ab62f

Browse files
authored
Create docker-compose.prod.yml
1 parent 38d03ed commit 08ab62f

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

docker-compose.prod.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
version: "3.9"
2+
3+
services:
4+
app:
5+
build:
6+
context: .
7+
dockerfile: docker/Dockerfile
8+
container_name: api_app_prod
9+
env_file: .env
10+
depends_on:
11+
db:
12+
condition: service_healthy
13+
command: bash -c "alembic upgrade head && gunicorn -k uvicorn.workers.UvicornWorker app.main:app -w 4 -b 0.0.0.0:8000 --timeout 90"
14+
working_dir: /code
15+
ports:
16+
- "8000:8000"
17+
environment:
18+
ENVIRONMENT: production
19+
restart: unless-stopped
20+
volumes:
21+
- static_data:/code/static # opcional se futuramente servir arquivos estáticos
22+
23+
db:
24+
image: postgres:15
25+
container_name: api_db_prod
26+
environment:
27+
POSTGRES_USER: ${POSTGRES_USER}
28+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
29+
POSTGRES_DB: ${POSTGRES_DB}
30+
volumes:
31+
- db_data:/var/lib/postgresql/data
32+
ports:
33+
- "5432:5432"
34+
healthcheck:
35+
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
36+
interval: 10s
37+
timeout: 5s
38+
retries: 5
39+
40+
volumes:
41+
db_data:
42+
static_data:

0 commit comments

Comments
 (0)