59 lines
1.4 KiB
YAML
59 lines
1.4 KiB
YAML
services:
|
|
# Ghost 博客
|
|
ghost:
|
|
image: ghost:5
|
|
container_name: ghost_blog
|
|
restart: unless-stopped
|
|
environment:
|
|
database__client: mysql
|
|
database__connection__host: mysql
|
|
database__connection__user: ${DB_USER:-ghost}
|
|
database__connection__password: ${DB_PASSWORD:-password}
|
|
database__connection__database: ${DB_NAME:-ghost}
|
|
# 基本配置
|
|
url: ${GHOST_URL:-http://localhost:2368}
|
|
NODE_ENV: ${NODE_ENV:-production}
|
|
volumes:
|
|
- ./data:/var/lib/ghost/content
|
|
ports:
|
|
- "127.0.0.1:${GHOST_PORT:-2368}:2368"
|
|
networks:
|
|
- ghost-network
|
|
depends_on:
|
|
- mysql
|
|
|
|
# MySQL 数据库
|
|
mysql:
|
|
image: mysql:8
|
|
container_name: ghost_mysql
|
|
restart: unless-stopped
|
|
environment:
|
|
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-root}
|
|
MYSQL_DATABASE: ${DB_NAME:-ghost}
|
|
MYSQL_USER: ${DB_USER:-ghost}
|
|
MYSQL_PASSWORD: ${DB_PASSWORD:-password}
|
|
volumes:
|
|
- ./mysql_data:/var/lib/mysql
|
|
networks:
|
|
- ghost-network
|
|
|
|
# Caddy 反向代理
|
|
caddy:
|
|
image: caddy:latest
|
|
container_name: caddy_proxy
|
|
restart: unless-stopped
|
|
network_mode: host
|
|
ports:
|
|
- "0.0.0.0:80:80"
|
|
- "0.0.0.0:443:443"
|
|
volumes:
|
|
- ./Caddyfile:/etc/caddy/Caddyfile
|
|
environment:
|
|
- GHOST_HOST=${GHOST_HOST:-localhost}
|
|
- GHOST_PORT=${GHOST_PORT:-2368}
|
|
|
|
# 网络定义
|
|
networks:
|
|
ghost-network:
|
|
driver: bridge
|