增加支持docker部署
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
# 使用官方Python镜像作为基础镜像
|
||||
FROM python:3.12-slim
|
||||
|
||||
# 设置工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 安装Node.js (pywencai需要)
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
gnupg \
|
||||
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# 验证安装
|
||||
RUN node --version && npm --version
|
||||
|
||||
# 复制依赖文件
|
||||
COPY requirements.txt .
|
||||
|
||||
# 安装Python依赖
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# 复制项目文件
|
||||
COPY . .
|
||||
|
||||
# 创建必要的目录
|
||||
RUN mkdir -p /app/data && chmod 777 /app/data
|
||||
|
||||
# 暴露Streamlit默认端口
|
||||
EXPOSE 8501
|
||||
|
||||
# 设置健康检查
|
||||
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
||||
|
||||
# 启动应用
|
||||
CMD ["python", "run.py"]
|
||||
|
||||
Reference in New Issue
Block a user