Dockerfile
FROM python:3.10-buster
RUN (echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" > /etc/apt/sources.list)
RUN (apt-get update) && (apt-get upgrade)
RUN (apt-get install -y lsb-release wget ttf-wqy-zenhei xfonts-intl-chinese wqy*)
WORKDIR /code
RUN mkdir /code/depends
# 下载并安装 chrome, TIPS: dpkg 不会处理依赖,要使用 apt 安装 deb
RUN (wget -P /code/depends https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb) && ( apt install -y /code/depends/google-chrome-stable_current_amd64.deb)
COPY install.py /code/
RUN python install.py
RUN /usr/local/bin/python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
COPY requirements-prd.txt /code/
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements-prd.txt
COPY config.yaml /code/
COPY . /code/
让我们一行一行来看
RUN (echo "deb http://mirrors.aliyun.com/debian/ buster main non-free contrib" > /etc/apt/sources.list)
这行的作用是使用 aliyun 的 debian apt 仓库,原因当然是邪恶长城RUN (apt-get update) && (apt-get upgrade)
更新一下 apt 源,并更新软件。可以只要apt-get update
,而删除apt-get upgrade
,后者不是必须项RUN (apt-get install -y lsb-release wget ttf-wqy-zenhei xfonts-intl-chinese wqy*)
这几个包用来干嘛呢?安装中文字体,作用会在下面讲到