version: '3'

services:
  tl_api:
    build:
      context: .
      dockerfile: ./Dockerfile
    image: registry.yingcaibx.com/tl/api:latest
    restart: always
    container_name: tl_api
    environment:
      - SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL=jdbc:mysql://172.28.175.70:3306/tl?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
#      - MQTT-SERVER=tcp://172.28.175.70:1883
    networks:
      - docker_networks_default
    deploy: #限制资源使用
      resources:
        limits:
          cpus: '0.50'
          memory: 2048M
    labels:
      - "traefik.http.routers.tl_api.rule=Host(`test.tl.web.yingcaibx.com`) && PathPrefix(`/api`)"
      - "traefik.http.routers.tl_api.middlewares=tl_api-stripprefix"
      - "traefik.http.middlewares.tl_api-stripprefix.stripprefix.prefixes=/api"
      - "traefik.http.routers.tl_api.entrypoints=websecure"
      - "traefik.http.routers.tl_api.tls.certresolver=yxt"

networks:
  docker_networks_default:
    external: true