-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_ubuntu_2204
66 lines (55 loc) · 3.01 KB
/
Dockerfile_ubuntu_2204
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
FROM ubuntu:22.04 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 C.UTF-8
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential \
ca-certificates \
curl \
gawk \
git \
libbz2-dev \
libffi-dev \
liblzma-dev \
libncursesw5-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
zlib1g-dev && \
rm -rf /var/lib/apt/lists/*
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.7 3.8 3.9 3.10 3.11 3.12; 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 ubuntu:22.04
ENV PYENV_ROOT "/usr/local/pyenv"
ENV PATH "${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates \
libbz2-1.0 \
libffi7 \
liblzma5 \
libncursesw5 \
libreadline8 \
libsqlite3-0 \
libssl3 \
zlib1g && \
rm -rf /var/lib/apt/lists/*
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"]