add backend docker build files

This commit is contained in:
刘金宝
2026-06-01 17:57:31 +08:00
parent 132155c280
commit 93d9e1c6a5
4 changed files with 63 additions and 1 deletions
+28
View File
@@ -0,0 +1,28 @@
.git
.env
.env.*
!.env.example
__pycache__/
*.py[cod]
*.pyo
.pytest_cache/
.ruff_cache/
.mypy_cache/
.coverage
backend/.venv/
backend/storage/
storage/
reports/
uploads/
*.db
*.sqlite
*.sqlite3
*.log
*.pdf
frontend/
docs/
demo_frontend/
scripts/
+28
View File
@@ -0,0 +1,28 @@
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
COPY backend/requirements.txt ./requirements.txt
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple \
--no-cache-dir \
-r requirements.txt
COPY backend ./backend
WORKDIR /app/backend
EXPOSE 9000
CMD [
"uvicorn",
"app.main:app",
"--host",
"0.0.0.0",
"--port",
"9000"
]
+7
View File
@@ -24,6 +24,13 @@ cd backend
uvicorn app.main:app --host 127.0.0.1 --port 9000 uvicorn app.main:app --host 127.0.0.1 --port 9000
``` ```
Docker 构建与运行:
```powershell
docker build -t medical-consultation-agent-backend .
docker run --env-file .env -p 9000:9000 medical-consultation-agent-backend
```
## 服务依赖 ## 服务依赖
MySQL 使用容器或内网服务名 `mysql` MySQL 使用容器或内网服务名 `mysql`
-1
View File
@@ -7,5 +7,4 @@ aiomysql>=0.2.0
httpx>=0.27.0 httpx>=0.27.0
python-dotenv>=1.0.0 python-dotenv>=1.0.0
reportlab>=4.2.0 reportlab>=4.2.0
streamlit>=1.36.0
redis>=5.0.0 redis>=5.0.0