---

version: "3"

services:
  todo-webserver:
    container_name: todo-webserver
    restart: unless-stopped
    build:
      context: .
      dockerfile: development.webserver.Dockerfile
      args:
        CUSTOM_UID: 1000
        CUSTOM_GID: 1000
    environment:
      TZ: Europe/Berlin
    ports:
      - "8000:8000"
    volumes:
      - ./Caddyfile:/app/Caddyfile
  todo-frontend:
    container_name: todo-frontend
    restart: unless-stopped
    depends_on:
      - todo-webserver
    build:
      context: .
      dockerfile: development.frontend.Dockerfile
      args:
        CUSTOM_UID: 1000
        CUSTOM_GID: 1000
    environment:
      TZ: Europe/Berlin
    expose:
      - "3000"
    volumes:
      - ./frontend/postcss.config.js:/app/postcss.config.js:ro
      - ./frontend/svelte.config.js:/app/svelte.config.js:ro
      - ./frontend/tailwind.config.js:/app/tailwind.config.js:ro
      - ./frontend/tsconfig.json:/app/tsconfig.json:ro
      - ./frontend/vite.config.ts:/app/vite.config.ts:ro
      - ./frontend/src:/app/src:ro
      - ./frontend/static:/app/static:ro
  todo-backend:
    container_name: todo-backend
    restart: unless-stopped
    depends_on:
      - todo-webserver
      - todo-db
    build:
      context: .
      dockerfile: ./development.backend.Dockerfile
      args:
        CUSTOM_UID: 1000
        CUSTOM_GID: 1000
    expose:
      - "3000"
    volumes:
      - ./backend/todo/:/app/todo:ro
      - ./backend/requirements.txt:/app/requirements.txt:ro
    environment:
      APP_NAME: "TodoApp"
      ADMIN_EMAIL: "admin@example.com"
      DEBUG_MODE: "true"
      POSTGRES_HOST: "todo-db"
      POSTGRES_PORT: "5432"
      POSTGRES_DB: "todo"
      POSTGRES_USER: "todo"
      POSTGRES_PASSWORD: "todo"
  todo-db:
    image: postgres:alpine
    container_name: todo-db
    restart: unless-stopped
    expose:
      - "5432"
    volumes:
      - ./.postgres:/var/lib/postgresql/data
    environment:
      POSTGRES_DB: "todo"
      POSTGRES_USER: "todo"
      POSTGRES_PASSWORD: "todo"
  todo-pgweb:
    image: sosedoff/pgweb
    container_name: todo-pgweb
    restart: unless-stopped
    depends_on:
      - todo-db
    ports:
      - "8001:8081"
    environment:
      PGWEB_DATABASE_URL: "postgres://todo:todo@todo-db:5432/todo?sslmode=disable"

...
