humanus.cpp/.devops/docker-compose.yml

35 lines
1.1 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

services:
humanus:
build:
context: ..
dockerfile: .devops/Dockerfile
target: release # 使用第二阶段作为最终镜像
args:
# 添加buildkit参数提高构建稳定性
BUILDKIT_INLINE_CACHE: 1
DOCKER_BUILDKIT: 1
container_name: humanus_cpp
volumes:
# 挂载源代码目录,方便开发时修改代码
- ..:/app
# 创建独立的构建目录,避免覆盖本地构建
- humanus_build:/app/build
ports:
# 如果项目有需要暴露的端口,可以在这里添加
- "8818:8818"
environment:
# 可以在此处设置环境变量
- PYTHONPATH=/app
# 添加DNS相关环境变量避免容器内网络问题
- DNS_OPTS=8.8.8.8,8.8.4.4
# 开发模式下使用交互式终端
stdin_open: true
tty: true
# 默认命令
command: /bin/bash
# 可选使用host网络模式解决某些网络问题仅限Linux
# network_mode: "host"
volumes:
humanus_build:
# 创建一个命名卷用于存储构建文件