version: "3.8"

networks:
  http_network:
    external: true
  moretcg:
    external: false
services:
  db:
    image: postgres:alpine
    environment:
      - POSTGRES_USER=moretcg
      - POSTGRES_PASSWORD=moretcg
      - POSTGRES_DB=moretcg
    volumes:
      - ./postgres:/var/lib/postgresql/data
    networks:
      - moretcg
  app:
    image: huskyteufel/webshop
    restart: always
    environment:
      - DB_HOST=db
      - DB_USER=moretcg
      - DB_PASS=moretcg
      - DB_DATA=moretcg
      - PROXYIP=172.19.0.9
      #volumes:
      #- /var/run/docker.sock:/var/run/docker.sock
      #- portainer_data:/data
    labels:
      # Frontend
      - "traefik.enable=true"
      - "traefik.http.routers.moretcg-shop.entrypoints=http"
      - "traefik.http.routers.moretcg-shop.rule=Host(`drone.cosysda.de`)"
      - "traefik.http.middlewares.moretcg-shop-https-redirect.redirectscheme.scheme=https"
      - "traefik.http.routers.moretcg-shop.middlewares=moretcg-shop-https-redirect"
      - "traefik.http.routers.moretcg-shop-secure.entrypoints=https"
      - "traefik.http.routers.moretcg-shop-secure.rule=Host(`drone.cosysda.de`)"
      - "traefik.http.routers.moretcg-shop-secure.tls=true"
      - "traefik.http.routers.moretcg-shop-secure.tls.certresolver=http"
      - "traefik.http.routers.moretcg-shop-secure.service=moretcg-shop"
      - "traefik.http.services.moretcg-shop.loadbalancer.server.port=9000"
      - "traefik.docker.network=http_network"
    networks:
      - http_network
      - moretcg
