volumes: postgres_data: networks: frontend: driver: bridge name: frontend backend: ipam: driver: default config: - subnet: "172.16.240.0/24" services: web: build: context: ./webapp ports: - "8000:8000" environment: - FLASK_APP=app.py - ENVIRONMENT=development - DATABASE_URL= networks: - frontend - backend profiles: - development web-staging: build: context: ./webapp ports: - "8000:8000" environment: - FLASK_APP=app.py - ENVIRONMENT=staging - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres depends_on: - db networks: - frontend - backend profiles: - staging web-production: build: context: ./webapp ports: - "8000:8000" environment: - FLASK_APP=app.py - ENVIRONMENT=production - DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres depends_on: - db networks: - frontend - backend profiles: - production db: image: postgres:14 ports: - "5432:5432" volumes: - postgres_data:/var/lib/postgresql/data environment: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - POSTGRES_DB=postgres networks: backend: ipv4_address: 172.16.240.10 profiles: - production - staging