deb http://mirrors.163.com/debian/ buster main non-free contrib deb http://mirrors.163.com/debian/ buster-updates main non-free contrib deb http://mirrors.163.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.163.com/debian/ buster main non-free contrib deb-src http://mirrors.163.com/debian/ buster-updates main non-free contrib deb-src http://mirrors.163.com/debian/ buster-backports main non-free contrib deb http://mirrors.163.com/debian-security/ buster/updates main non-free contrib deb-src http://mirrors.163.com/debian-security/ buster/updates main non-free contrib sources.list 作用说明:官方提供的 jenkins/ssh-slave 并没有 python,需要安装 python 就要去更新他的安装包,此时如果使用他默认的镜像源会非常慢,因此我们换一个更快的源,将它原来的文件覆盖掉就行了,这里要根据自己的版本号进行修改,我的是 buster 版本,当然你下载后也应该是和我的一样。
4、写 Dockerfile
FROM jenkins/ssh-slave:latest USER root WORKDIR /app ADD requirements.txt /app ADD sources.list /etc/apt/ RUN echoexportJAVA_TOOL_OPTIONS="-Dfile.encoding=UTF-8">> /etc/profile RUN apt-get -y update &&apt-get -y install python3 &&apt-get -y install python3-pip && pip3 install -r requirements.txt -i https://pypi.douban.com/simple