50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
# docker-compose.dev.yml
|
|
version: '3.8'
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: verificaEfos_postgres_1
|
|
environment:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: postgres
|
|
ports:
|
|
- "5432:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U postgres -d postgres"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.dev
|
|
container_name: verificaEfos_app-1
|
|
environment:
|
|
DATABASE_URL: postgresql+psycopg2://postgres:postgres@postgres:5432/postgres
|
|
ports:
|
|
- "8000:8000"
|
|
volumes:
|
|
- .:/app
|
|
- /app/__pycache__
|
|
working_dir: /app
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
command: >
|
|
sh -c "
|
|
echo 'Esperando a que PostgreSQL esté listo...' &&
|
|
sleep 3 &&
|
|
echo 'Ejecutando migraciones...' &&
|
|
alembic upgrade head &&
|
|
echo 'Iniciando aplicación...' &&
|
|
uvicorn main:app --host 0.0.0.0 --port 8000 --reload
|
|
"
|
|
|
|
volumes:
|
|
postgres_data: |