services: db: image: postgres:15 environment: # TODO: Should not be hardcoded on the code POSTGRES_USER: myuser POSTGRES_PASSWORD: mypassword POSTGRES_DB: mydatabase volumes: - postgres_data:/var/lib/postgresql/data ports: - "5432:5432" healthcheck: test: [ "CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}" ] interval: 5s retries: 5 start_period: 5s timeout: 10s api: build: context: backend/ dockerfile: Dockerfile # Your FastAPI Dockerfile path environment: # TODO: Should not be hardcoded on the code - DATABASE_URL=postgresql://myuser:mypassword@db:5432/mydatabase ports: - "8000:8000" depends_on: db: condition: service_healthy restart: true frontend: build: context: frontend/ dockerfile: Dockerfile # Your FastAPI Dockerfile path ports: - "3000:3000" depends_on: - db volumes: postgres_data: