version: '3.8'

services:
  littleshop:
    build: .
    image: littleshop:latest
    container_name: littleshop
    restart: unless-stopped
    environment:
      - ASPNETCORE_ENVIRONMENT=Production
      - ASPNETCORE_URLS=http://+:8080
      - JWT_SECRET_KEY=${JWT_SECRET_KEY:-YourSuperSecretKeyThatIsAtLeast32CharactersLong!}
      - BTCPAY_SERVER_URL=${BTCPAY_SERVER_URL:-}
      - BTCPAY_STORE_ID=${BTCPAY_STORE_ID:-}
      - BTCPAY_API_KEY=${BTCPAY_API_KEY:-}
      - BTCPAY_WEBHOOK_SECRET=${BTCPAY_WEBHOOK_SECRET:-}
    volumes:
      - littleshop_data:/app/data
      - littleshop_uploads:/app/wwwroot/uploads
      - littleshop_logs:/app/logs
    networks:
      - traefik
      - default
    labels:
      # Traefik configuration
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      
      # HTTP Router
      - "traefik.http.routers.littleshop.rule=Host(`littleshop.silverlabs.uk`)"
      - "traefik.http.routers.littleshop.entrypoints=websecure"
      - "traefik.http.routers.littleshop.tls=true"
      - "traefik.http.routers.littleshop.tls.certresolver=letsencrypt"
      
      # Service
      - "traefik.http.services.littleshop.loadbalancer.server.port=8080"
      
      # Middleware for forwarded headers
      - "traefik.http.routers.littleshop.middlewares=littleshop-headers"
      - "traefik.http.middlewares.littleshop-headers.headers.customrequestheaders.X-Forwarded-Proto=https"
      - "traefik.http.middlewares.littleshop-headers.headers.customrequestheaders.X-Forwarded-Host=littleshop.silverlabs.uk"

volumes:
  littleshop_data:
    driver: local
  littleshop_uploads:
    driver: local
  littleshop_logs:
    driver: local

networks:
  traefik:
    external: true
  default:
    driver: bridge