-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_centos_7
76 lines (63 loc) · 2.78 KB
/
Dockerfile_centos_7
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
69
70
71
72
73
74
75
76
FROM centos:7 as builder
LABEL maintainer="Ingo Meyer <[email protected]>"
ENV PYENV_ROOT "/usr/local/pyenv"
ENV PATH "${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
ENV LANG en_US.utf8
# CentOS 7 has reached end-of-life on 2024-06-30, thus use vault mirrors
RUN sed \
-i \
-e 's/^mirrorlist/#mirrorlist/g' \
-e 's%#baseurl=http://mirror.centos.org%baseurl=http://vault.centos.org%g' \
/etc/yum.repos.d/CentOS-*
RUN yum groupinstall -y "Development Tools" && \
yum install -y bzip2-devel \
ca-certificates \
curl \
libffi-devel \
ncurses-devel \
openssl-devel \
readline-devel \
sqlite-devel \
xz-devel \
zlib-devel && \
yum clean all
RUN curl -o "/tmp/pyenv-master.tar.gz" -L "https://github.com/pyenv/pyenv/archive/master.tar.gz" && \
tar -C /tmp/ -xvf "/tmp/pyenv-master.tar.gz" && \
mv "/tmp/pyenv-master" "${PYENV_ROOT}"
RUN if [ ! -d "${PYENV_ROOT}/plugins/python-build/share/python-build/patches/3.3.7" ]; then \
cp -r "${PYENV_ROOT}/plugins/python-build/share/python-build/patches/3.3.6" "${PYENV_ROOT}/plugins/python-build/share/python-build/patches/3.3.7" && \
mv "${PYENV_ROOT}/plugins/python-build/share/python-build/patches/3.3.7/Python-3.3.6" "${PYENV_ROOT}/plugins/python-build/share/python-build/patches/3.3.7/Python-3.3.7"; \
fi
RUN set -e; \
installed_python_versions=""; \
for version in 2.7 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9; do \
latest_version="$(pyenv install --list | awk "NR > 1 && \$1 ~ /^$(echo "${version}" | sed 's/\./\\./g')(\.[0-9.]*)?(-dev)?$/" | tail -1 | tr -d ' ')"; \
pyenv install "${latest_version}"; \
installed_python_versions="${latest_version} ${installed_python_versions}"; \
done; \
pyenv global ${installed_python_versions}
RUN pip install -U pip && \
pip install tox
FROM centos:7
ENV PYENV_ROOT "/usr/local/pyenv"
ENV PATH "${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
# CentOS 7 has reached end-of-life on 2024-06-30, thus use vault mirrors
RUN sed \
-i \
-e 's/^mirrorlist/#mirrorlist/g' \
-e 's%#baseurl=http://mirror.centos.org%baseurl=http://vault.centos.org%g' \
/etc/yum.repos.d/CentOS-*
RUN yum install -y bzip2 \
ca-certificates \
libffi \
ncurses \
openssl \
readline \
sqlite \
xz \
zlib && \
yum clean all
COPY --from=builder "${PYENV_ROOT}" "${PYENV_ROOT}"
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["/bin/bash"]