1- FROM ubuntu:20.04
1+ ARG TIME_WARP=""
2+ FROM ubuntu:20.04 AS base
23
34ENV DEBIAN_FRONTEND=noninteractive
45RUN apt-get update && \
56 apt-get install -y locales && \
67 apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
7- localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \
8- && rm -rf /var/lib/apt/lists/*
8+ localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 && \
9+ rm -rf /var/lib/apt/lists/*
910ENV LANG=en_US.UTF-8
1011
1112# Using apt-get update alone in a RUN statement causes caching issues and subsequent apt-get install instructions fail.
@@ -29,21 +30,24 @@ RUN apt-get update && \
2930 ca-certificates && \
3031 apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
3132
32- # Install our own CAs on the image.
33- # Assumes Linux Debian based image.
34- COPY CAs/* /usr/local/share/ca-certificates/
35- # Store custom CAs somewhere where the backend can find them later.
36- COPY CustomCAs/* /usr/local/share/custom-ca-certificates/
37- RUN update-ca-certificates
38-
3933# Install pyenv
4034RUN git clone https://github.com/pyenv/pyenv.git .pyenv
4135ENV PYENV_ROOT=/.pyenv
4236ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"
37+ ENV PIP_NO_CACHE_DIR=1
38+
39+
40+ FROM base AS base-py-arg
41+ # Install all supported Python versions
42+ ARG PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 3.7"
43+
4344
44- # Setup python version
45- ENV PYTHON_VERSIONS="3.13 3.12 3.11 3.10 3.9 3.8 3.7"
45+ FROM base AS base-py-arg-single-python
46+ # Only install Python 3.7 in time warp mode
47+ ARG PYTHON_VERSIONS="3.7"
4648
49+
50+ FROM base-py-arg${TIME_WARP:+"-single-python" } AS base-py-install
4751RUN for version in $PYTHON_VERSIONS; do \
4852 pyenv install $version; \
4953 done
@@ -57,3 +61,34 @@ RUN for version in $PYTHON_VERSIONS; do \
5761 python$version -m pip install -U pip && \
5862 python$version -m pip install -U coverage tox; \
5963 done
64+
65+
66+ FROM base-py-install AS backend-timewarp
67+ WORKDIR /home/root/testkit
68+ COPY requirements*.txt .
69+ COPY testkit/backend.py testkit/build.py testkit/_common.py .
70+ RUN sed -i 's|-e \. .*$||' requirements*.txt
71+
72+ ARG TIME_WARP
73+ RUN for version in $PYTHON_VERSIONS; do \
74+ TEST_BACKEND_VERSION="python$version" python build.py && \
75+ python$version -m pip install --force-reinstall neo4j==${TIME_WARP}; \
76+ done
77+ COPY testkitbackend ./testkitbackend
78+ ENTRYPOINT ["python" , "backend.py" ]
79+
80+
81+ FROM base-py-install AS backend
82+ # Install our own CAs on the image.
83+ # Assumes Linux Debian based image.
84+ COPY CAs/* /usr/local/share/ca-certificates/
85+ # Store custom CAs somewhere where the backend can find them later.
86+ COPY CustomCAs/* /usr/local/share/custom-ca-certificates/
87+ RUN update-ca-certificates
88+
89+
90+ FROM backend${TIME_WARP:+"-timewarp" } AS final
91+ ARG TIME_WARP
92+ ENV DRIVER_TIME_WARP=$TIME_WARP
93+ WORKDIR /home/root/testkit
94+ EXPOSE 9876/tcp
0 commit comments