version: '2.2'
services:
  shengtai_postgres: # 数据库
    # restart: always # 一ac直启动
    image: shengtai_postgres:v1 # 镜像（已自定义好的）
    container_name: shengtai_postgres # 容器名称
    ports: # 端口暴露（对外）
      - 5432:5432
    volumes: # 挂载数据目录
      - /mnt/shengtai/docker/postgresql_14_1/data/:/var/lib/postgresql/data
    networks: # 同一网络，保障访问
      - shengtai
    cap_drop: # 权限
      - ALL
    cap_add: # 权限
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
    environment: #
      - POSTGRES_PASSWORD=kingtom888*

  shengtai_http_app: # 应用程序
    # restart: always # 保持一直启动
    image: shengtai_http_app:v1 # 镜像（已自定义好的）
    container_name: shengtai_http_app # 容器名称
    depends_on: # 启动顺序依赖
      - shengtai_postgres
    ports: # 端口暴露（对外）
      - 8080:8080
    networks: # 同一网络保障访问
      - shengtai
    volumes: # 日志挂载
      - /mnt/shengtai/docker/app_http_jdk_17/app_logs:/mnt/app_logs
      - /mnt/shengtai/docker/nginx_https_1_25_1/www/upload:/mnt/app_storage
      - /mnt/shengtai/docker/app_http_jdk_17/app_jars:/mnt/app_jars
    cap_drop: # 权限
      - ALL
    cap_add: # 权限
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
    links: # 链接到mysql
      - shengtai_postgres:shengtai_postgres
  shengtai_https_nginx: # 前端程序
    image: shengtai_https_nginx:v1 # 镜像（已自定义好的）
    container_name: shengtai_https_nginx # 容器名称
    privileged: true
    tty: true
    depends_on: # 启动顺序依赖
      - shengtai_http_app
    ports: # 端口暴露（对外）
      - 8081:80
      - 443:443
    networks: # 同一网络保障访问
      - shengtai
    volumes: # 日志挂载
      - /mnt/shengtai/docker/nginx_https_1_25_1/www:/usr/share/nginx/html
      - /mnt/shengtai/docker/nginx_https_1_25_1/logs:/var/log/nginx
      - /mnt/shengtai/docker/nginx_https_1_25_1/conf/nginx.conf:/etc/nginx/nginx.conf
      - /mnt/shengtai/docker/nginx_https_1_25_1/conf/conf.d/default.conf:/etc/nginx/conf.d/default.conf
    cap_drop: # 权限
      - ALL
    cap_add: # 权限
      - CHOWN
      - DAC_OVERRIDE
      - SETGID
      - SETUID
networks:
  shengtai:
    external: false