Files
PyContainer-Handbuch/docker-compose.yml
2025-12-04 11:54:41 +01:00

22 lines
655 B
YAML

version: '3.8'
services:
app:
build: .
volumes:
- ./app:/home/appuser/app
command: ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
labels:
- "traefik.enable=true"
# Define a router for the app service
- "traefik.http.routers.app-router.rule=Host(`localhost`)"
- "traefik.http.routers.app-router.entrypoints=web"
# Define the service port (internal to the container)
- "traefik.http.services.app-service.loadbalancer.server.port=8000"
networks:
- web
networks:
web:
external: true # This network is assumed to be created by a central Traefik instance