feat: 添加云托管部署配置文件 #1

Merged
liangguodong merged 1 commits from feature/cloud-deploy into master 2026-03-05 19:01:14 +08:00
4 changed files with 65 additions and 0 deletions

19
server/.dockerignore Normal file
View File

@@ -0,0 +1,19 @@
# 忽略本地环境配置
.env
.env.*
# 忽略缓存
__pycache__/
*.pyc
*.pyo
# 忽略git
.git/
.gitignore
# 忽略测试文件
test_*.py
# 忽略IDE
.idea/
.vscode/

19
server/Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM python:3.11-slim
WORKDIR /app
# 安装依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# 复制代码
COPY . .
# 删除本地环境配置,使用容器环境变量
RUN rm -f .env
# 暴露端口
EXPOSE 3000
# 启动命令
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "3000"]

View File

@@ -0,0 +1,26 @@
{
"containerPort": 3000,
"dockerfilePath": "Dockerfile",
"buildDir": "",
"minNum": 0,
"maxNum": 10,
"cpu": 0.5,
"mem": 1,
"policyType": "cpu",
"policyThreshold": 60,
"envParams": {
"SERVER_HOST": "0.0.0.0",
"SERVER_PORT": "3000",
"DEBUG": "False",
"DB_HOST": "10.45.108.178",
"DB_PORT": "3306",
"DB_USER": "root",
"DB_PASSWORD": "!Lgd20020523",
"DB_NAME": "stardom_story",
"AI_SERVICE_ENABLED": "True",
"AI_PROVIDER": "deepseek",
"DEEPSEEK_API_KEY": "sk-a685e8a0e97e41e4b3cb70fa6fcc3af1",
"DEEPSEEK_BASE_URL": "https://api.deepseek.com/v1",
"DEEPSEEK_MODEL": "deepseek-chat"
}
}

View File

@@ -8,3 +8,4 @@ pydantic==2.5.2
pydantic-settings==2.1.0
python-dotenv==1.0.0
python-multipart==0.0.6
httpx==0.27.0