Update testing Dockerfile to use non EOL Ubuntu 20.04, removed non
supported versions (Python 2.5) and add new versions we support (Python
3.9, Python 3.10).
Also add a check which errors out in case docker build doesn't run from
the repository root.
Also run black-check and bandit target in the docker image.
# Docker image used for running tests the under all the supported Python
# versions
-FROM ubuntu:18.04
+FROM ubuntu:20.04
RUN set -e && \
apt-get update && \
@@ -27,15 +27,19 @@ RUN set -e && \
add-apt-repository ppa:pypy/ppa && \
apt-get update && \
apt-get -y install \
- python3.5 \
python3.6 \
python3.7 \
python3.8 \
+ python3.9 \
+ python3.10 \
python-dev \
- python3.5-dev \
python3.6-dev \
python3.7-dev \
python3.8-dev \
+ python3.9-dev \
+ python3.10-dev \
+ python3.7-distutils \
+ python3.8-distutils \
pypy3 \
pypy3-dev \
python3-pip \
@@ -46,13 +50,15 @@ RUN set -e && \
libssl-dev
# Workaround for zipp import error issue - https://github.com/pypa/virtualenv/issues/1630
-RUN python3 -m pip install --upgrade pip
+RUN python3.8 -m pip install --upgrade pip
RUN set -e && \
- python3 -m pip install --no-cache-dir "tox==3.20.1"
+ python3.8 -m pip install --no-cache-dir "tox==3.25.1"
COPY . /libcloud
+RUN if [ ! -f "/libcloud/README.rst" ]; then echo "libcloud/README.rst file not found, you are likely not running docker build from the repository root directory"; exit 1; fi
+
WORKDIR /libcloud
-CMD ["tox", "-e", "lint,py3.5,py3.6,py3.7,py3.8,pypypy3"]
+CMD ["tox", "-e", "lint,black-check,py3.6,py3.7,py3.8,py3.9,py3.10,pypypy3"]
