Files
superlink/deploy/docker-compose.yml
T

67 lines
1.9 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SuperLink 部署编排(对齐服务器 license_server 既有 compose 风格)
# 服务:db(MySQL8) / app(PHP-FPM) / web(nginx)
# 使用:cp .env.example .env 并填好口令;docker compose up -d --build
# 访问:http://<服务器IP>:8081/
name: mysuperlink
services:
db:
image: mysql:8.0
restart: unless-stopped
env_file: .env
environment:
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASS}
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS}
command:
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
- --default-authentication-plugin=mysql_native_password
volumes:
- db_data:/var/lib/mysql
- ./mysql/initdb/01_schema_base.sh:/docker-entrypoint-initdb.d/01_schema_base.sh:ro
- ./mysql/initdb/02_seed_admin.sql:/docker-entrypoint-initdb.d/99_seed_admin.sql:ro
# 说明:compose 相对路径以 deploy/ 为基准,../ 即仓库根目录(SuperLink)
- ../:/repo # 仓库根目录挂到 /repo,init 脚本 source 仓库 sql
- ../sql:/repo/sql:ro
- ../config:/repo/config:ro
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -u$$MYSQL_USER -p$$MYSQL_PASSWORD --silent"]
interval: 5s
timeout: 5s
retries: 30
start_period: 30s
app:
build: ./php
restart: unless-stopped
env_file: .env
environment:
DB_HOST: db
DB_PORT: "3306"
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASS: ${DB_PASS}
DB_CHARSET: utf8mb4
volumes:
- ../:/var/www/html
depends_on:
db:
condition: service_healthy
web:
image: nginx:1.25-alpine
restart: unless-stopped
ports:
- "8081:80"
environment:
- TZ=Asia/Shanghai
volumes:
- ../:/var/www/html:ro
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- app
volumes:
db_data: