增加多阶段构建,并在镜像中构建指定版本的vina 便于使用。

This commit is contained in:
2025-10-15 21:52:49 +08:00
parent 7ac0e58599
commit 1248cd187d
4 changed files with 200 additions and 107 deletions

View File

@@ -7,8 +7,6 @@ services:
dockerfile: docker/Dockerfile
args:
VINA_VERSION: ${VINA_VERSION:-1.2.7}
VINA_PLATFORM: ${VINA_PLATFORM:-linux}
DOWNLOAD_VINA: ${DOWNLOAD_VINA:-true}
image: vinatools:latest
container_name: vinatools-container
volumes:
@@ -19,8 +17,7 @@ services:
- ./results:/app/results
working_dir: /app
environment:
- PIXI_ROOT=/root/.pixi
- PATH=/root/.pixi/bin:/app/bin:$PATH
- PATH=/opt/venv/bin:/usr/local/bin:$PATH
# 保持容器运行
tty: true
stdin_open: true
@@ -28,6 +25,9 @@ services:
network_mode: host
# 重启策略
restart: unless-stopped
# 覆盖 ENTRYPOINT 用于交互式测试
entrypoint: ["/bin/bash"]
command: ["-c", "while true; do sleep 30; done"]
# 资源限制
deploy:
resources:
@@ -38,33 +38,29 @@ services:
memory: 2G
cpus: '1.0'
# 可选:用于 Jupyter Notebook 服务
jupyter:
build:
context: ..
dockerfile: docker/Dockerfile
args:
VINA_VERSION: ${VINA_VERSION:-1.2.7}
VINA_PLATFORM: ${VINA_PLATFORM:-linux_x86_64}
DOWNLOAD_VINA: ${DOWNLOAD_VINA:-true}
image: vinatools:latest
container_name: vinatools-jupyter
ports:
- "8888:8888"
volumes:
- ..:/app
- ./data:/app/data
- ./results:/app/results
working_dir: /app
environment:
- PIXI_ROOT=/root/.pixi
- PATH=/root/.pixi/bin:/app/bin:$PATH
command: >
bash -c "
/root/.pixi/bin/pixi workspace platform add linux-aarch64 &&
/root/.pixi/bin/pixi add jupyter notebook &&
/root/.pixi/bin/pixi run jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.password=''
"
restart: unless-stopped
depends_on:
- vinatools
# # 可选:用于 Jupyter Notebook 服务
# jupyter:
# build:
# context: ..
# dockerfile: docker/Dockerfile
# args:
# VINA_VERSION: ${VINA_VERSION:-1.2.7}
# image: vinatools:latest
# container_name: vinatools-jupyter
# ports:
# - "8888:8888"
# volumes:
# - ..:/app
# - ./data:/app/data
# - ./results:/app/results
# working_dir: /app
# environment:
# - PATH=/usr/local/bin:$PATH
# command: >
# bash -c "
# pip3 install jupyter notebook &&
# jupyter notebook --ip=0.0.0.0 --port=8888 --no-browser --allow-root --NotebookApp.token='' --NotebookApp.password=''
# "
# restart: unless-stopped
# depends_on:
# - vinatools