co / Dockerfile
yzwwxm's picture
Update Dockerfile
ae96b90 verified
raw
history blame contribute delete
698 Bytes
# 使用Python 3.11作为基础镜像
FROM python:3.11-slim
# 设置工作目录
WORKDIR /app
# 安装系统依赖和Google Chrome
RUN apt-get update \
&& apt-get install -y \
wget \
gnupg \
unzip \
libxss1 \
fonts-liberation \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*
# 复制requirements.txt并安装Python依赖
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 复制应用代码
COPY . .
# 创建static目录(如果不存在)
RUN mkdir -p static
# 暴露端口
EXPOSE 8000
# 设置环境变量
ENV PYTHONPATH=/app
# 运行应用
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]