version: "3.6"

services:
  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: tcmonline-backend
    restart: always
    ports:
      - "8181:8080"
    volumes:
      - "tcm-upload:/home/tcmonline/uploadPath" # 持久化上传的文件
    environment:
      - "JAVA_OPTS=-Duser.language=zh -XX:+UseG1GC"
      - "TZ=Asia/Shanghai"
      # - "spring.datasource.url=jdbc:mysql://mysql:3306/tduck?useSSL=false&useUnicode=true&characterEncoding=utf8&serverTimezone=UTC&tinyInt1isBit=false" #数据库连接地址
      # - "spring.datasource.username=root"
      # - "spring.datasource.password=root"
      - "snyu.profile=/home/tcmonline/uploadPath"

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
    container_name: tcmonline-frontend
    ports:
      - "8080:80"
    restart: always
    volumes:
      - ./frontend/conf/nginx.conf:/etc/nginx/nginx.conf
      - ./frontend/conf/conf.d:/etc/nginx/conf.d
      - ./frontend/dist:/var/www/html
    links:
      - backend:api
    depends_on:
      - backend

volumes:
  tcm-upload:
