Skip to content

Commit a0dd605

Browse files
committed
Ubuntu 16.04: Switch from Python 2.7 to Python 3.10
Because in Funq we (finally) dropped support for Python 2. Manually installing a recent Python version because Python 3.5 from the official Ubuntu repos might lead to troubles sooner or later since it is EOL already. In addition, no longer installing Python packages we actually don't need in this image anymore.
1 parent 0ed375c commit a0dd605

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

ubuntu-16.04/Dockerfile

+37-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ RUN apt-get update -q && apt-get -y -q install --no-install-recommends \
1616
graphviz \
1717
libc++-dev \
1818
libc++abi-dev \
19+
libffi-dev \
1920
libglu1-mesa-dev \
2021
libqt5opengl5 \
2122
libqt5opengl5-dev \
2223
libqt5svg5-dev \
2324
libqt5sql5-sqlite \
2425
make \
2526
openssl \
26-
python \
2727
qt5-default \
2828
qtdeclarative5-dev \
2929
qtdeclarative5-qtquick2-plugin \
@@ -35,14 +35,43 @@ RUN apt-get update -q && apt-get -y -q install --no-install-recommends \
3535
zlib1g-dev \
3636
&& rm -rf /var/lib/apt/lists/*
3737

38-
# Install PIP (the version from APT is not sufficient)
39-
RUN curl "https://bootstrap.pypa.io/2.7/get-pip.py" -o get-pip.py \
40-
&& python get-pip.py
38+
# Remove DST root certificate since it is not compatible with OpenSSL 1.0. This
39+
# is only needed for building the Docker image, afterwards we will have a newer
40+
# OpenSSL library.
41+
# See https://medium.com/geekculture/will-you-be-impacted-by-letsencrypt-dst-root-ca-x3-expiration-d54a018df257
42+
RUN sed -i 's/mozilla\/DST_Root_CA_X3.crt/!mozilla\/DST_Root_CA_X3.crt/g' \
43+
/etc/ca-certificates.conf && update-ca-certificates
4144

42-
# Install Python packages
43-
RUN pip install \
44-
"future==0.17.1" \
45-
"flake8==3.7.7"
45+
# Install OpenSSL 1.1 for Python/pip.
46+
ARG OPENSSL_VERSION="1.1.1l"
47+
RUN wget -c "https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz" -O /tmp.tar.gz \
48+
&& tar -zxf /tmp.tar.gz \
49+
&& cd "./openssl-$OPENSSL_VERSION" \
50+
&& ./config --prefix=/usr --openssldir=/etc/ssl '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)' \
51+
&& make -s -j8 \
52+
&& make install > /dev/null \
53+
&& cd .. \
54+
&& rm -rf "./openssl-$OPENSSL_VERSION" \
55+
&& rm /tmp.tar.gz
56+
57+
# Install Python & pip
58+
# Note: Actually Python 3.5 from the official Ubuntu repositories is
59+
# sufficient for us, but having a more recent version simplifies dependency
60+
# management since then we can drop support for Python 3.5.
61+
ARG PYTHON_VERSION="3.10.0"
62+
RUN wget "https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz" \
63+
&& tar xzvf "./Python-$PYTHON_VERSION.tgz" \
64+
&& cd "./Python-$PYTHON_VERSION" \
65+
&& ./configure \
66+
&& make -j8 \
67+
&& make install \
68+
&& cd .. \
69+
&& rm -rf "./Python-$PYTHON_VERSION" \
70+
&& rm "./Python-$PYTHON_VERSION.tgz" \
71+
&& update-alternatives --install /usr/bin/python python /usr/local/bin/python3.10 100 \
72+
&& curl "https://bootstrap.pypa.io/pip/get-pip.py" -o get-pip.py \
73+
&& python get-pip.py \
74+
&& rm get-pip.py
4675

4776
# LibrePCB's unittests expect that there is a USERNAME environment variable
4877
ENV USERNAME="root"

0 commit comments

Comments
 (0)