-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.base
68 lines (58 loc) · 4.64 KB
/
Dockerfile.base
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
FROM ubuntu:16.04
ENV TZ='Asia/Shanghai'
ENV SHELL=/bin/bash
SHELL ["/bin/bash","-c"]
ENV DEBIAN_FRONTEND=noninteractive
ENV MANYLINUX_CPPFLAGS="-Wdate-time -D_FORTIFY_SOURCE=2"
ENV MANYLINUX_CFLAGS="-g -O2 -Wall -fdebug-prefix-map=/=. -fstack-protector-strong -Wformat -Werror=format-security"
ENV MANYLINUX_CXXFLAGS="-g -O2 -Wall -fdebug-prefix-map=/=. -fstack-protector-strong -Wformat -Werror=format-security"
ENV MANYLINUX_LDFLAGS="-Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now"
ENV AUDITWHEEL_POLICY=manylinux_2_24
# 获取主机架构并赋值给 AUDITWHEEL_ARCH 环境变量
RUN export AUDITWHEEL_ARCH=$(uname -m) && \
echo "AUDITWHEEL_ARCH is set to $AUDITWHEEL_ARCH" \
echo "AUDITWHEEL_PLAT=${AUDITWHEEL_POLICY}_${AUDITWHEEL_ARCH}" >> /etc/environment
RUN ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& apt update -qq \
&& apt install --no-install-recommends -qq -y apt-utils dialog \
&& apt install --no-install-recommends -qq -y wget curl ca-certificates apt-transport-https \
&& mkdir -p /usr/local/share/keyrings \
&& curl -fsSL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x0FFB30A4102243D5" \
| gpg --dearmor | tee /usr/local/share/keyrings/richard-cmake.gpg > /dev/null \
&& echo "deb [signed-by=/usr/local/share/keyrings/richard-cmake.gpg] https://ppa.launchpadcontent.net/richard-deng/cmake/ubuntu/ xenial main" \
| tee /etc/apt/sources.list.d/richard-deng-ubuntu-cmake.list \
&& apt update -qq \
&& apt install --no-install-recommends -qq -y sudo git make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev llvm libncursesw5-dev xz-utils tk-dev \
libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev unzip ccache cmake openssl g++ \
&& if [[ "$(dpkg --print-architecture)" = i386 ]]; then \
apt --no-install-recommends -qq -y install gcc-multilib g++-multilib ; \
fi \
&& apt clean autoclean \
&& rm -rf /var/lib/{apt,cache,log} \
&& adduser --shell /bin/bash --disabled-password --gecos "" arm \
&& adduser arm sudo \
&& echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers \
&& echo "[global]" >> /etc/pip.conf \
&& echo "extra-index-url=https://mirrors.cernet.edu.cn/pypi/web/simple https://pypi.tuna.tsinghua.edu.cn/simple" >> /etc/pip.conf \
&& echo "trusted-host = mirrors.cernet.edu.cn pypi.tuna.tsinghua.edu.cn pypi.org" >> /etc/pip.conf
RUN git clone https://github.com/pyenv/pyenv.git --depth 1 \
&& cd pyenv/plugins/python-build \
&& sudo bash ./install.sh
RUN env PYTHON_MAKE_OPTS="-j$(nproc)" CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS} -fPIC" CXXFLAGS="${MANYLINUX_CXXFLAGS} -fPIC" LDFLAGS="${MANYLINUX_LDFLAGS} -fPIC" \
PYTHON_CONFIGURE_OPTS="--enable-shared --with-openssl-rpath=auto --with-ensurepip=no" python-build 2.7.18 /opt/_internal/cpython-2.7.18 \
&& curl -fsSL https://bootstrap.pypa.io/pip/2.7/get-pip.py | /opt/_internal/cpython-2.7.18/bin/python -
RUN env PYTHON_MAKE_OPTS="-j$(nproc)" CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS} -fPIC" CXXFLAGS="${MANYLINUX_CXXFLAGS} -fPIC" LDFLAGS="${MANYLINUX_LDFLAGS} -fPIC" \
PYTHON_CONFIGURE_OPTS="--enable-shared --with-openssl-rpath=auto --with-ensurepip=no" python-build 3.5.10 /opt/_internal/cpython-3.5.10 \
&& curl -fsSL https://bootstrap.pypa.io/pip/3.5/get-pip.py | /opt/_internal/cpython-3.5.10/bin/python -
RUN env PYTHON_MAKE_OPTS="-j$(nproc)" CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS} -fPIC" CXXFLAGS="${MANYLINUX_CXXFLAGS} -fPIC" LDFLAGS="${MANYLINUX_LDFLAGS} -fPIC" \
PYTHON_CONFIGURE_OPTS="--enable-shared --with-openssl-rpath=auto --with-ensurepip=no" python-build 3.6.15 /opt/_internal/cpython-3.6.15 \
&& curl -fsSL https://bootstrap.pypa.io/pip/3.6/get-pip.py | /opt/_internal/cpython-3.6.15/bin/python -
RUN env PYTHON_MAKE_OPTS="-j$(nproc)" CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS} -fPIC" CXXFLAGS="${MANYLINUX_CXXFLAGS} -fPIC" LDFLAGS="${MANYLINUX_LDFLAGS} -fPIC" \
PYTHON_CONFIGURE_OPTS="--enable-shared --with-openssl-rpath=auto --with-ensurepip=no" python-build 3.7.17 /opt/_internal/cpython-3.7.17 \
&& curl -fsSL https://bootstrap.pypa.io/pip/3.7/get-pip.py | /opt/_internal/cpython-3.7.17/bin/python -
RUN env PYTHON_MAKE_OPTS="-j$(nproc)" CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS} -fPIC" CXXFLAGS="${MANYLINUX_CXXFLAGS} -fPIC" LDFLAGS="${MANYLINUX_LDFLAGS} -fPIC" \
PYTHON_CONFIGURE_OPTS="--enable-shared --with-openssl-rpath=auto --with-ensurepip=no" python-build 3.8.20 /opt/_internal/cpython-3.8.20 \
&& curl -fsSL https://bootstrap.pypa.io/get-pip.py | /opt/_internal/cpython-3.8.20/bin/python -
USER arm
WORKDIR /io