Files
go-common/templates/docker-compose.example.yml

23 lines
641 B
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.

# docker-compose.yml 示例
# 展示如何在 docker-compose 中使用迁移工具
version: '3.8'
services:
app:
build: .
ports:
- "8080:8080"
volumes:
# 挂载配置文件(推荐:修改配置无需重启容器)
- ./config.json:/app/config.json:ro
# 启动时先执行迁移,再启动应用
command: sh -c "./migrate up && ./server"
# 使用说明:
# 1. 将此配置添加到你的 docker-compose.yml 中
# 2. 确保你的配置文件config.json包含数据库连接信息
# 3. 修改配置后手动执行迁移docker-compose exec app ./migrate up
# 4. 无需重启容器!