NB2 / Dockerfile
bobocup's picture
Update Dockerfile
0d67290 verified
raw
history blame contribute delete
783 Bytes
FROM python:3.9-slim
# 安装必要的系统依赖
RUN apt-get update && apt-get install -y \
wget \
gnupg \
chromium \
chromium-driver \
libgconf-2-4 \
libnss3 \
libxss1 \
libasound2 \
libatk-bridge2.0-0 \
libgtk-3-0 \
libgbm1 \
fonts-liberation \
&& rm -rf /var/lib/apt/lists/*
# 设置工作目录
WORKDIR /app
# 复制需要的文件
COPY requirements.txt .
COPY nb2.py .
# 安装Python依赖
RUN pip install -r requirements.txt
# 设置环境变量
ENV CHROME_BIN=/usr/bin/chromium
ENV CHROMEDRIVER_PATH=/usr/bin/chromedriver
ENV PYTHONUNBUFFERED=1
# 创建必要的目录和文件
RUN mkdir -p /tmp/chrome-data && \
touch /app/cookies.txt && \
chmod 777 /app/cookies.txt
# 启动脚本
CMD ["python", "nb2.py"]