Bug 1848: LTS Support

Updates base to Ubuntu 20.04
Updates python to 3.8
Updates pip dependencies to more recent versions
Adds apt cache to stage 2 dockerfile

Fixes bug 1848

Change-Id: I203d2d3f9ba636dfc12e0a640bdf445529713402
Signed-off-by: beierlm <mark.beierl@canonical.com>
diff --git a/Dockerfile b/Dockerfile
index 74b9c36..c597522 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,6 +23,12 @@
 
 FROM ubuntu:20.04
 
+ARG APT_PROXY
+RUN if [ ! -z $APT_PROXY ] ; then \
+    echo "Acquire::http::Proxy \"$APT_PROXY\";" > /etc/apt/apt.conf.d/proxy.conf ;\
+    echo "Acquire::https::Proxy \"$APT_PROXY\";" >> /etc/apt/apt.conf.d/proxy.conf ;\
+    fi
+
 RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
     DEBIAN_FRONTEND=noninteractive apt-get -y install \
         debhelper \
@@ -33,5 +39,5 @@
         python3-dev \
         python3-setuptools
 
-RUN python3 -m easy_install pip==21.0.1
-RUN pip3 install tox==3.22.0
+RUN python3 -m easy_install pip==21.3.1
+RUN pip install tox==3.24.5
diff --git a/requirements-dev.txt b/requirements-dev.txt
index e5ba877..21f6ba6 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,19 +1,3 @@
-aiokafka==0.7.0
-    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-dataclasses==0.6
-    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-kafka-python==2.0.2
-    # via
-    #   -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-    #   aiokafka
-git+https://osm.etsi.org/gerrit/osm/common.git@master#egg=osm-common
-    # via -r requirements-dev.in
-pycrypto==2.6.1
-    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-pymongo==3.11.3
-    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
-pyyaml==5.4.1
-    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
 #######################################################################################
 # Copyright ETSI Contributors and Others.
 #
@@ -30,3 +14,19 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #######################################################################################
+aiokafka==0.7.2
+    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+dataclasses==0.6
+    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+kafka-python==2.0.2
+    # via
+    #   -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+    #   aiokafka
+osm-common @ git+https://osm.etsi.org/gerrit/osm/common.git@master
+    # via -r requirements-dev.in
+pycrypto==2.6.1
+    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+pymongo==3.12.3
+    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
+pyyaml==5.4.1
+    # via -r https://osm.etsi.org/gitweb/?p=osm/common.git;a=blob_plain;f=requirements.txt;hb=master
diff --git a/requirements-dist.txt b/requirements-dist.txt
index 15a902a..8192b48 100644
--- a/requirements-dist.txt
+++ b/requirements-dist.txt
@@ -1,13 +1,3 @@
-setuptools-version-command==99.9
-    # via -r requirements-dist.in
-stdeb==0.10.0
-    # via -r requirements-dist.in
-
-# The following packages are considered to be unsafe in a requirements file:
-setuptools==59.8.0
-    # via
-    #   -r requirements-dist.in
-    #   setuptools-version-command
 #######################################################################################
 # Copyright ETSI Contributors and Others.
 #
@@ -24,3 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #######################################################################################
+setuptools-version-command==99.9
+    # via -r requirements-dist.in
+stdeb==0.10.0
+    # via -r requirements-dist.in
+
+# The following packages are considered to be unsafe in a requirements file:
+setuptools==59.8.0
+    # via
+    #   -r requirements-dist.in
+    #   setuptools-version-command
diff --git a/requirements-test.txt b/requirements-test.txt
index d0c984f..7589d84 100644
--- a/requirements-test.txt
+++ b/requirements-test.txt
@@ -1,13 +1,3 @@
-coverage==5.5
-    # via
-    #   -r requirements-test.in
-    #   nose2
-mock==4.0.3
-    # via -r requirements-test.in
-nose2==0.10.0
-    # via -r requirements-test.in
-six==1.15.0
-    # via nose2
 #######################################################################################
 # Copyright ETSI Contributors and Others.
 #
@@ -24,3 +14,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #######################################################################################
+coverage==6.2
+    # via
+    #   -r requirements-test.in
+    #   nose2
+mock==4.0.3
+    # via -r requirements-test.in
+nose2==0.10.0
+    # via -r requirements-test.in
+six==1.16.0
+    # via nose2
diff --git a/requirements.in b/requirements.in
index 8ad3006..1f1485e 100644
--- a/requirements.in
+++ b/requirements.in
@@ -16,7 +16,7 @@
 aiokafka
 peewee==3.8.*
 jsonschema==2.6.*
-pyyaml
+pyyaml==5.4.1
 pymysql==0.9.*
 peewee-migrate==1.1.*
 requests==2.*
diff --git a/requirements.txt b/requirements.txt
index 0fbd162..f100c24 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,35 +1,3 @@
-aiokafka==0.7.0
-    # via -r requirements.in
-cached-property==1.5.2
-    # via peewee-migrate
-certifi==2020.12.5
-    # via requests
-chardet==4.0.0
-    # via requests
-click==7.1.2
-    # via peewee-migrate
-idna==2.10
-    # via requests
-jsonschema==2.6.0
-    # via -r requirements.in
-kafka-python==2.0.2
-    # via aiokafka
-mock==4.0.3
-    # via peewee-migrate
-peewee-migrate==1.1.6
-    # via -r requirements.in
-peewee==3.8.2
-    # via
-    #   -r requirements.in
-    #   peewee-migrate
-pymysql==0.9.3
-    # via -r requirements.in
-pyyaml==5.4.1
-    # via -r requirements.in
-requests==2.25.1
-    # via -r requirements.in
-urllib3==1.26.4
-    # via requests
 #######################################################################################
 # Copyright ETSI Contributors and Others.
 #
@@ -46,3 +14,35 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #######################################################################################
+aiokafka==0.7.2
+    # via -r requirements.in
+cached-property==1.5.2
+    # via peewee-migrate
+certifi==2021.10.8
+    # via requests
+charset-normalizer==2.0.10
+    # via requests
+click==8.0.3
+    # via peewee-migrate
+idna==3.3
+    # via requests
+jsonschema==2.6.0
+    # via -r requirements.in
+kafka-python==2.0.2
+    # via aiokafka
+mock==4.0.3
+    # via peewee-migrate
+peewee==3.8.2
+    # via
+    #   -r requirements.in
+    #   peewee-migrate
+peewee-migrate==1.1.6
+    # via -r requirements.in
+pymysql==0.9.3
+    # via -r requirements.in
+pyyaml==5.4.1
+    # via -r requirements.in
+requests==2.27.1
+    # via -r requirements.in
+urllib3==1.26.8
+    # via requests
diff --git a/tox.ini b/tox.ini
index 64ae2f0..e06a856 100644
--- a/tox.ini
+++ b/tox.ini
@@ -23,7 +23,7 @@
 
 [testenv]
 usedevelop = True
-basepython = python3
+basepython = python3.8
 setenv = VIRTUAL_ENV={envdir}
          PYTHONDONTWRITEBYTECODE = 1
 deps =  -r{toxinidir}/requirements.txt
@@ -82,13 +82,18 @@
 
 #######################################################################################
 [testenv:pip-compile]
-deps =  pip-tools==5.5.0
+deps =  pip-tools==6.4.0
+skip_install = true
+whitelist_externals = bash
+        [
 commands =
-        - sh -c 'for file in requirements*.in ; do pip-compile -rU --no-header $file ;\
-        out=`echo $file | sed "s/.in/.txt/"` ; \
-        head -16 tox.ini >> $out ;\
-        done'
-whitelist_externals = sh
+        - bash -c "for file in requirements*.in ; do \
+        UNSAFE="" ; \
+        if [[ $file =~ 'dist' ]] ; then UNSAFE='--allow-unsafe' ; fi ; \
+        pip-compile -rU --no-header $UNSAFE $file ;\
+        out=`echo $file | sed 's/.in/.txt/'` ; \
+        sed -i -e '1 e head -16 tox.ini' $out ;\
+        done"
 
 
 #######################################################################################