-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
33 lines (30 loc) · 812 Bytes
/
Copy pathdocker-compose.yml
File metadata and controls
33 lines (30 loc) · 812 Bytes
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
version: "3"
volumes:
postgres-data:
services:
db:
image: postgres:14.3-alpine
restart: always
# make it available from localhost
# or use "expose: - 5432" for in-container access only
ports:
- "5432:5432"
environment:
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "admin"
POSTGRES_DB: "pypi"
volumes:
# connect db to volume not to lose data after stop
- postgres-data:/var/lib/postgresql/data
# populate db with data (db_dump.sql)
- .:/docker-entrypoint-initdb.d
app:
build: .
command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
restart: always
ports:
- "8000:8000"
environment:
DATABASE_URL: "postgresql+asyncpg://postgres:admin@db:5432/pypi"
depends_on:
- db