Files
URL-shortener/docker-compose.yml
T

30 lines
666 B
YAML

version: "3.9"
services:
db:
image: postgres:16
container_name: url_shortener_db
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: url_db
volumes:
- postgres_data:/var/lib/postgresql/data
app:
build: .
container_name: url_shortener_app
depends_on:
- db
environment:
DATABASE_URL: postgresql+psycopg2://postgres:postgres@db:5432/url_db
BASE_URL: http://localhost:8000
ports:
- "8000:8000"
command: >
sh -c "alembic upgrade head &&
uvicorn app.main:app --host 0.0.0.0 --port 8000"
volumes:
postgres_data: