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*)
这几个包用来干嘛呢?装置中文字体,作用会在上面讲到
解决中文显示为方块的问题:
简中互联网上,会有人教你,如何本人装置手动下载 ttf 文件,而后复制粘贴,而后怎么怎么样,一堆操作。我就很无语,他们真的是一点不懂什么叫做 Linux 吗?
没有这么多麻烦的事件,你装个 Linux Desktop 难道不是自带中文的?还要你本人去网上下字体文件的?
很简略,apt 仓库外面都有筹备好的字体,间接用 apt 命令一键装置就好了!
apt-get install -y lsb-release wget ttf-wqy-zenhei xfonts-intl-chinese wqy*