From badba2662f9d25ca86409b69e86bcc186c62255f Mon Sep 17 00:00:00 2001 From: XIE7654 <765462425@qq.com> Date: Sun, 13 Jul 2025 21:42:25 +0800 Subject: [PATCH] update docker dev.yml --- backend/Dockerfile | 6 ++-- ...chatrole_knowledge_alter_chatrole_tools.py | 23 +++++++++++++ backend/requirements.txt | 3 +- docker-compose.dev.yml | 4 +++ web/Dockerfile | 34 ++++++++++++------- 5 files changed, 55 insertions(+), 15 deletions(-) create mode 100644 backend/ai/migrations/0002_alter_chatrole_knowledge_alter_chatrole_tools.py diff --git a/backend/Dockerfile b/backend/Dockerfile index 5232f28..608b883 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -16,7 +16,7 @@ COPY . . RUN pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple # 入口命令由 docker-compose 控制 # 数据库迁移 -RUN python manage.py makemigrations && python manage.py migrate +#RUN python manage.py makemigrations && python manage.py migrate # 收集静态文件 RUN python manage.py collectstatic --noinput @@ -26,7 +26,9 @@ RUN python manage.py collectstatic --noinput FROM base AS dev -CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] +#CMD ["tail", "-f", "/dev/null"] + +#CMD ["daphne", "backend.asgi:application"] # CMD ["sh", "-c", "sleep 5 && python manage.py runserver 0.0.0.0:8000"] diff --git a/backend/ai/migrations/0002_alter_chatrole_knowledge_alter_chatrole_tools.py b/backend/ai/migrations/0002_alter_chatrole_knowledge_alter_chatrole_tools.py new file mode 100644 index 0000000..5b5bba1 --- /dev/null +++ b/backend/ai/migrations/0002_alter_chatrole_knowledge_alter_chatrole_tools.py @@ -0,0 +1,23 @@ +# Generated by Django 5.2.1 on 2025-07-13 12:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ai', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='chatrole', + name='knowledge', + field=models.ManyToManyField(blank=True, related_name='roles', to='ai.knowledge', verbose_name='关联的知识库'), + ), + migrations.AlterField( + model_name='chatrole', + name='tools', + field=models.ManyToManyField(blank=True, related_name='roles', to='ai.tool', verbose_name='关联的工具'), + ), + ] diff --git a/backend/requirements.txt b/backend/requirements.txt index b89c8da..c51b739 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -18,4 +18,5 @@ django-ninja==1.4.3 openai==1.95 daphne==4.2.1 langchain==0.3.26 -langchain-community==0.3.27 \ No newline at end of file +langchain-community==0.3.27 +channels==4.2.2 \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index e143f00..1a6a3bf 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -91,6 +91,10 @@ services: depends_on: db: condition: service_healthy + command: > + sh -c "python manage.py makemigrations && + python manage.py migrate && + daphne -b 0.0.0.0 backend.asgi:application" web: build: diff --git a/web/Dockerfile b/web/Dockerfile index 5baa26b..e22d97c 100644 --- a/web/Dockerfile +++ b/web/Dockerfile @@ -5,23 +5,33 @@ FROM node:22.17.0 AS base WORKDIR /app ENV PNPM_SKIP_PROMPT=true +ENV CI=true + +RUN corepack enable && corepack prepare pnpm@10.10.0 --activate + +COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./ + +# +RUN pnpm install --frozen-lockfile + # 拷贝项目 COPY . . +#RUN pnpm i # 安装 pnpm -RUN corepack enable && corepack prepare pnpm@latest --activate - -# 清理依赖缓存 -RUN pnpm store prune && rm -rf $(pnpm store path) && \ - rm -rf node_modules .npmrc package-lock.json pnpm-lock.yaml .pnpm-store .turbo && \ - find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + - -RUN npm run clean - -# 安装依赖 -RUN pnpm install --force +#RUN corepack enable && corepack prepare pnpm@latest --activate +# +## 清理依赖缓存 +#RUN pnpm store prune && rm -rf $(pnpm store path) && \ +# rm -rf node_modules .npmrc package-lock.json pnpm-lock.yaml .pnpm-store .turbo && \ +# find . -name 'node_modules' -type d -prune -exec rm -rf '{}' + +# +##RUN pnpm run clean +# +## 安装依赖 +##RUN pnpm install --force @@ -33,7 +43,7 @@ FROM base AS dev # 暴露端口(根据需要) EXPOSE 5678 -# CMD ["tail", "-f", "/dev/null"] +#CMD ["tail", "-f", "/dev/null"] # 启动开发服务器 CMD ["npm", "run", "dev:antd"]