Skip to content

Commit

Permalink
Merge pull request #33 from pic4xiu/master
Browse files Browse the repository at this point in the history
把 apt 默认源还原为官方源,同时提供清华源为另一选择
  • Loading branch information
firmianay authored Jul 30, 2023
2 parents 0f29de0 + 96106c1 commit 80a58b0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions baseImage/ubuntu1604/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
FROM ubuntu:16.04
LABEL Author="firmianay@gmail.com"
ARG MISE

RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list && \
RUN if [ "$MISE" = "TSINGHUA" ]; then \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse" > /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse" >> /etc/apt/sources.list; \
fi && \
apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends python python-pip python-setuptools python-wheel && \
# python 2 和 3 在一条命令里安装时 pip 会出错,不知道为什么;最新的 pip 已经不支持 python2 和 python3.5
apt-get install -y --no-install-recommends python3 python3-pip python3-setuptools python3-wheel && \
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple "pip < 21.0" -U && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple "pip < 21.0" -U && \
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
if [ "$MISE" = "TSINGHUA" ]; then \
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple "pip < 21.0" -U && pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple "pip < 21.0" -U && \
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple; \
else \
pip install "pip < 21.0" -U && pip3 install "pip < 21.0" -U; \
fi && \
apt-get install -y --no-install-recommends iputils-ping vim-tiny net-tools nmap telnet && \
rm -rf /var/lib/apt/lists/*

Expand Down
2 changes: 1 addition & 1 deletion baseImage/ubuntu1604/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Ubuntu 16.04 镜像

1. 替换 apt 源和 pypi
1. 考虑到稳定性,未对 apt 源和 pypi 源进行替换。可以通过在构建镜像语句中添加 `--build-arg MISE=TSINGHUA` 完成替换
2. 安装 python2 和 python3
3. 安装 iputils-ping vim-tiny net-tools nmap telnet

0 comments on commit 80a58b0

Please sign in to comment.