修改环境要求,确保在 ARM 架构的设备上也能正常使用 Docker 启动

This commit is contained in:
Wenjie Zhang 2025-02-24 11:27:08 +08:00
parent 198ea233d5
commit f1ba6cd787
7 changed files with 40 additions and 11 deletions

View File

@ -1,5 +1,5 @@
# 使用基础镜像
FROM pytorch/pytorch:2.4.1-cuda11.8-cudnn9-runtime
FROM python:3.12
# 设置工作目录
WORKDIR /app
@ -9,11 +9,10 @@ COPY ../requirements.txt /app/requirements.txt
# 安装依赖Docker 会缓存这一步,除非 requirements.txt 发生变化)
RUN pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN pip install -U gunicorn -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
# RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
# RUN sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y

View File

@ -11,7 +11,7 @@ services:
- ../src/static/config.dev.yaml:/app/src/static/config.yaml
- ${MODEL_DIR}:${MODEL_DIR} # 如果出现 undefined volume MODEL_DIR: invalid compose project请添加此环境变量或者注释此行
ports:
- "5000:5000"
- "5050:5050"
depends_on:
- graph
- milvus
@ -23,7 +23,7 @@ services:
- NEO4J_PASSWORD=0123456789
- MILVUS_URI=http://milvus:19530
- MODEL_DIR=${MODEL_DIR} # 优先级高于 .env 中的 MODEL_DIR
command: uvicorn src.main:app --host 0.0.0.0 --port 5000 --reload
command: uvicorn src.main:app --host 0.0.0.0 --port 5050 --reload
web:
build:
@ -42,7 +42,7 @@ services:
- app-network
environment:
- NODE_ENV=development
- VITE_API_URL=http://api:5000 # 添加这行
- VITE_API_URL=http://api:5050 # 添加这行
command: npm run server
graph:

View File

@ -1,5 +1,5 @@
# 开发阶段
FROM node:22.10.0 AS development
FROM node:latest AS development
WORKDIR /app
# 复制 package.json 和 package-lock.json如果存在
@ -17,7 +17,7 @@ EXPOSE 5173
# 启动开发服务器的命令在 docker-compose 文件中定义
# 生产阶段
FROM node:22.10.0 AS build-stage
FROM node:latest AS build-stage
WORKDIR /app
COPY ./web/package*.json ./

View File

@ -18,7 +18,7 @@ torch>=2.4.0
tqdm>=4.66.1
zhipuai>=2.1.2
neo4j>=5.22.0
sentencepiece==0.1.99
sentencepiece>=0.1.99
llama-index-readers-file
opencv-python-headless
docx2txt

10
scripts/run_docker.sh Normal file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# 检查是否提供了命令行参数
if [ $# -eq 0 ]; then
echo "请提供命令参数例如up -d 或 down"
exit 1
fi
# 将所有命令行参数传递给 docker compose 命令
docker compose -f docker/docker-compose.dev.yml --env-file src/.env "$@"

View File

@ -1 +1,3 @@
ZHIPUAI_API_KEY=<ZHIPUAI_API_KEY>
ZHIPUAI_API_KEY=270ea71e9******97.e3XOMdWKuZb7Q1Sk
SILICONFLOW_API_KEY=sk-aeoamptic****vdmozbpdsofstmoqnvsmbvql
MODEL_DIR=/home/user/Documents/projects/Yuxi-Know/models

View File

@ -0,0 +1,18 @@
embed_model: siliconflow/BAAI/bge-m3
enable_knowledge_base: true
enable_knowledge_graph: false
enable_reranker: true
enable_search_engine: false
enable_web_search: false
filename: src/static/config.yaml
model_dir: /Users/wenjie/Documents/projects/Yuxi-Know/models
model_local_paths: {}
model_name: Qwen/Qwen2.5-7B-Instruct
model_provider: siliconflow
reranker: siliconflow/BAAI/bge-reranker-v2-m3
save_dir: saves
stream: true
use_rewrite_query: 'off'
valuable_model_provider:
- zhipu
- siliconflow