version: "3.8" services: # Mattermost Team Edition mattermost: image: mattermost/mattermost-team-edition:latest container_name: mattermost hostname: mattermost ports: - "8065:8065" environment: # 数据库配置 MM_SQLSETTINGS_DRIVERNAME: "postgres" MM_SQLSETTINGS_DATASOURCE: "postgres://mattermost:mattermost_password@postgres:5432/mattermost?sslmode=disable&connect_timeout=10" # 服务配置 MM_SERVICESETTINGS_SITEURL: "http://localhost:8065" MM_SERVICESETTINGS_LISTENADDRESS: ":8065" MM_SERVICESETTINGS_ENABLEDEVELOPER: "true" # 文件存储配置 MM_FILESETTINGS_DRIVERNAME: "local" MM_FILESETTINGS_DIRECTORY: "/mattermost/data/" # 日志配置 MM_LOGSETTINGS_ENABLECONSOLE: "true" MM_LOGSETTINGS_CONSOLELEVEL: "INFO" # 用户配置 MM_TEAMSETTINGS_ENABLEUSERCREATION: "true" MM_TEAMSETTINGS_ENABLEOPENSERVER: "true" MM_SERVICESETTINGS_ENABLEEMAILINVITATIONS: "false" # 安全配置 MM_SERVICESETTINGS_ENABLEINSECUREOUTGOINGCONNECTIONS: "true" # 插件配置 MM_PLUGINSETTINGS_ENABLE: "true" MM_PLUGINSETTINGS_ENABLEUPLOADS: "true" depends_on: postgres: condition: service_healthy networks: - mattermost_network volumes: - ./mattermost_data:/mattermost/data - ./mattermost_config:/mattermost/config - ./mattermost_logs:/mattermost/logs - ./mattermost_plugins:/mattermost/plugins restart: unless-stopped healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8065/api/v4/system/ping"] interval: 30s timeout: 10s retries: 3 start_period: 90s # PostgreSQL数据库 postgres: image: postgres:13-alpine container_name: mattermost_postgres environment: POSTGRES_DB: mattermost POSTGRES_USER: mattermost POSTGRES_PASSWORD: mattermost_password POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=C --lc-ctype=C" volumes: - ./postgres_data:/var/lib/postgresql/data networks: - mattermost_network restart: unless-stopped healthcheck: test: ["CMD-SHELL", "pg_isready -U mattermost -d mattermost"] interval: 30s timeout: 10s retries: 3 start_period: 30s networks: mattermost_network: driver: bridge # 使用绑定挂载,数据存储在当前目录下 # volumes 部分已删除,因为使用 ./目录 的绑定挂载