This commit is contained in:
wxa 2025-04-11 11:52:05 -04:00 committed by GitHub
commit 9d6fce7445
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 54 additions and 0 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
# 替换为自己的python镜像地址
FROM registry.cn-hangzhou.aliyuncs.com/wxa/python:3.12
# 设置工作目录
WORKDIR /app
# 复制 requirements.txt 和安装依赖
COPY requirements.txt /app/requirements.txt
# 安装依赖,指定阿里镜像源
RUN pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ -r /app/requirements.txt
# 复制源代码到容器内
COPY . /app
# 设置容器的默认命令
CMD ["python", "main.py"]

42
comfyui.yaml Normal file
View File

@ -0,0 +1,42 @@
# 配置docker配置文件启用gpu
#{
# "runtimes": {
# "nvidia": {
# "args": [],
# "path": "nvidia-container-runtime"
# }
# }
#}
# 打包启动镜像命令docker compose build up -d
version: '1'
services:
app:
build: .
container_name: comfyui
runtime: nvidia
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [ gpu ]
volumes:
- .:/app
- ./app/models/Stable-diffusion:/app/models/Stable-diffusion # 绑定模型目录
ports:
- "8188:8188" # 如果你的应用需要暴露端口
command: python main.py # 启动 main.py 文件
environment:
- PYTHONUNBUFFERED=1 # 确保输出不会被缓冲
working_dir: /app
restart: always
networks:
- my_custom_network
networks:
my_custom_network:
name: comfyui