version: '3'

services:
  tl_api:
    build:
      context: .
      dockerfile: ./Dockerfile
    image: registry.yingcaibx.com/tl/api:latest
    restart: always
    container_name: tl_api
    environment:
      - SPRING_PROFILES_ACTIVE=dev
      - SPRING_DATASOURCE_DYNAMIC_DATASOURCE_MASTER_URL=jdbc:mysql://mysql:3306/tl?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&autoReconnect=true&failOverReadOnly=false
#      - MQTT-SERVER=tcp://172.28.175.70:1883
    ports:
      - 8001:8080
    networks:
      - dockertest_bx_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:
  dockertest_bx_default:
    external: true