Skip to content

Commit 5e2fee3

Browse files
authored
Merge pull request #15 from reecetech/DE-5170-add-py3.10
Add Python 3.10 support
2 parents f179207 + 458b15a commit 5e2fee3

File tree

2 files changed

+58
-5
lines changed

2 files changed

+58
-5
lines changed

Dockerfile.testing

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,19 @@ FROM python:3.9 AS py39
1818

1919
RUN echo "${PYTHON_VERSION}" > /tmp/py39-latest
2020

21+
##------------------------------------------------------------------------------
22+
FROM python:3.10 AS py310
23+
24+
RUN echo "${PYTHON_VERSION}" > /tmp/py310-latest
25+
2126
##------------------------------------------------------------------------------
2227
FROM centos:7 AS base
2328

29+
# EPEL needed for openssl 1.1.x
2430
RUN yum clean all \
2531
&& yum update -y \
2632
&& yum install -y \
33+
epel-release \
2734
nmap-ncat \
2835
unixODBC \
2936
&& yum clean all \
@@ -42,6 +49,15 @@ RUN yum-builddep -y python3
4249
RUN yum install -y \
4350
unixODBC-devel
4451

52+
# Python >= 3.10 needs openssl 1.1.x
53+
RUN yum install -y \
54+
openssl11-devel
55+
56+
RUN mkdir /usr/local/openssl11 \
57+
&& cd /usr/local/openssl11 \
58+
&& ln -s /usr/lib64/openssl11 lib \
59+
&& ln -s /usr/include/openssl11 include
60+
4561
RUN mkdir /src
4662

4763
##------------------------------------------------------------------------------
@@ -61,7 +77,7 @@ RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
6177

6278
RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
6379
&& cd "/tmp/Python-${PYTHON_VERSION}" \
64-
&& ./configure --prefix=/opt/py${py_ver} \
80+
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
6581
&& make install
6682

6783
USER root
@@ -94,7 +110,7 @@ RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
94110

95111
RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
96112
&& cd "/tmp/Python-${PYTHON_VERSION}" \
97-
&& ./configure --prefix=/opt/py${py_ver} \
113+
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
98114
&& make install
99115

100116
USER root
@@ -127,7 +143,40 @@ RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
127143

128144
RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
129145
&& cd "/tmp/Python-${PYTHON_VERSION}" \
130-
&& ./configure --prefix=/opt/py${py_ver} \
146+
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
147+
&& make install
148+
149+
USER root
150+
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
151+
RUN pip3 install tox
152+
USER ${nonroot_uid}
153+
154+
ENV HOME=/src
155+
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
156+
WORKDIR /src
157+
158+
ADD django_informixdb_vault/ /src/django_informixdb_vault/
159+
ADD README.rst setup.* tox.ini /src/
160+
RUN tox -e "$(tox --listenvs | grep py${py_ver} | tr '\n' ',')" --notest # prep venvs
161+
162+
##------------------------------------------------------------------------------
163+
FROM builder-base AS builder-py310
164+
ARG py_ver=310
165+
ARG nonroot_uid
166+
COPY --from=py310 /tmp/py${py_ver}-latest /tmp/
167+
168+
RUN mkdir /opt/py${py_ver} && chown -R ${nonroot_uid} /opt/py${py_ver} /src
169+
USER ${nonroot_uid}
170+
WORKDIR /tmp
171+
172+
RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
173+
&& curl --silent --show-error --fail --location \
174+
"https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \
175+
| tar -xz
176+
177+
RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
178+
&& cd "/tmp/Python-${PYTHON_VERSION}" \
179+
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
131180
&& make install
132181

133182
USER root
@@ -167,6 +216,10 @@ COPY --from=builder-py39 /opt/py39/ /opt/py39/
167216
COPY --from=builder-py39 /src/.tox/ /src/.tox/
168217
COPY --from=builder-py39 /src/.cache/ /src/.cache/
169218

219+
COPY --from=builder-py310 /opt/py310/ /opt/py310/
220+
COPY --from=builder-py310 /src/.tox/ /src/.tox/
221+
COPY --from=builder-py310 /src/.cache/ /src/.cache/
222+
170223
ADD wait-for-deps.sh /usr/local/bin
171224
RUN chmod a+rx /usr/local/bin/wait-for-deps.sh
172225

@@ -175,7 +228,7 @@ ADD --chown=${nonroot_uid} django_informixdb_vault/ /src/django_informixdb_vault
175228
ADD --chown=${nonroot_uid} test/ /src/test/
176229
RUN chown ${nonroot_uid} /src
177230

178-
ENV PATH=/opt/py39/bin:/opt/py38/bin:/opt/py37/bin:"${PATH}"
231+
ENV PATH=/opt/py310/bin:/opt/py39/bin:/opt/py38/bin:/opt/py37/bin:"${PATH}"
179232
RUN pip3 --no-cache-dir install tox
180233

181234
USER ${nonroot_uid}

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py37-dj3,py38-dj3,py39-dj3
2+
envlist = py37-dj3,py38-dj3,py39-dj3,py310-dj3
33

44
[testenv]
55
deps =

0 commit comments

Comments
 (0)