[PATCH 4/4] docker-compose: Massively simplify
Stephen Finucane
stephen at that.guru
Sat May 4 08:21:10 AEST 2019
Now that we can run tox on the localhost, we no longer need to install
the variety of Python versions we previously did and can keep this
purely for the 'manage.py' use cases.
Note that we're also able to remove the 'libmysqlclient-dev' and
'mysql-client' packages thanks to our switch to 'PyMySQL', which is pure
Python.
Signed-off-by: Stephen Finucane <stephen at that.guru>
---
tools/docker/Dockerfile | 22 ++--------------------
tools/docker/entrypoint.sh | 4 ++--
tools/docker/trusty-ports.list | 3 ---
tools/docker/trusty.list | 3 ---
tools/docker/xenial-ports.list | 3 ---
tools/docker/xenial.list | 3 ---
tox.ini | 15 ++++++++++++++-
7 files changed, 18 insertions(+), 35 deletions(-)
delete mode 100644 tools/docker/trusty-ports.list
delete mode 100644 tools/docker/trusty.list
delete mode 100644 tools/docker/xenial-ports.list
delete mode 100644 tools/docker/xenial.list
diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile
index 76bb6b2b..5653ec89 100644
--- a/tools/docker/Dockerfile
+++ b/tools/docker/Dockerfile
@@ -17,26 +17,10 @@ ENV PYTHONUNBUFFERED 1
# System
-# trusty and findutils is for python3.4; xenial is for python3.5
-# TODO(stephenfin): Are curl, unzip required?
-COPY tools/docker/*.list /etc/apt/sources.list.d/
-
-RUN cd /etc/apt/sources.list.d; \
- echo $(uname -m) > /tmp/arch; \
- if [ $(cat /tmp/arch) != 'x86_64' ] && grep -q -v "i.86" /tmp/arch; then \
- mv trusty-ports.list trusty.list; \
- mv xenial-ports.list xenial.list; \
- else \
- rm *-ports.list; \
- fi
-
RUN apt-get update -qq && \
apt-get install -y --no-install-recommends --allow-downgrades \
- python-dev python-pip python-setuptools python-wheel \
- python3.5-dev python3-pip python3-setuptools python3-wheel \
- python3.4-dev findutils=4.4.2-7 python3.6-dev \
- libmysqlclient-dev mysql-client curl unzip build-essential \
- git postgresql-client tzdata libpq-dev
+ python3-dev python3-pip python3-setuptools python3-wheel \
+ postgresql-client tzdata
# User
RUN useradd --uid=$UID --create-home patchwork
@@ -51,8 +35,6 @@ RUN rm /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
COPY requirements-*.txt /tmp/
RUN pip3 install virtualenv tox && \
pip3 install -r /tmp/requirements-dev.txt
-RUN pip2 install virtualenv tox && \
- pip2 install -r /tmp/requirements-dev.txt
# we deliberately leave the requirements files in tmp so we can
# ping the user in entrypoint.sh if the change them!
diff --git a/tools/docker/entrypoint.sh b/tools/docker/entrypoint.sh
index 32f7132a..b28de5a0 100755
--- a/tools/docker/entrypoint.sh
+++ b/tools/docker/entrypoint.sh
@@ -124,8 +124,8 @@ elif [ "$1" == "--test" ] || [ "$1" == "--quick-test" ]; then
shift
python3 manage.py test $@
elif [ "$1" == "--tox" ] || [ "$1" == "--quick-tox" ]; then
- shift
- tox $@
+ echo "tox is no longer installed here; use e.g. 'tox -e py36-django21-mysql' instead"
+ exit 0
else # run whatever CMD is set to
$@
fi
diff --git a/tools/docker/trusty-ports.list b/tools/docker/trusty-ports.list
deleted file mode 100644
index ebcf4fa4..00000000
--- a/tools/docker/trusty-ports.list
+++ /dev/null
@@ -1,3 +0,0 @@
-deb http://ports.ubuntu.com/ubuntu-ports/ trusty main
-deb http://ports.ubuntu.com/ubuntu-ports/ trusty-updates main
-deb http://ports.ubuntu.com/ubuntu-ports/ trusty-security main
diff --git a/tools/docker/trusty.list b/tools/docker/trusty.list
deleted file mode 100644
index 8bb92c09..00000000
--- a/tools/docker/trusty.list
+++ /dev/null
@@ -1,3 +0,0 @@
-deb http://archive.ubuntu.com/ubuntu/ trusty main
-deb http://archive.ubuntu.com/ubuntu/ trusty-updates main
-deb http://security.ubuntu.com/ubuntu trusty-security main
diff --git a/tools/docker/xenial-ports.list b/tools/docker/xenial-ports.list
deleted file mode 100644
index d84641fa..00000000
--- a/tools/docker/xenial-ports.list
+++ /dev/null
@@ -1,3 +0,0 @@
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial main
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main
-deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main
diff --git a/tools/docker/xenial.list b/tools/docker/xenial.list
deleted file mode 100644
index a70ff56a..00000000
--- a/tools/docker/xenial.list
+++ /dev/null
@@ -1,3 +0,0 @@
-deb http://archive.ubuntu.com/ubuntu/ xenial main
-deb http://archive.ubuntu.com/ubuntu/ xenial-updates main
-deb http://security.ubuntu.com/ubuntu xenial-security main
diff --git a/tox.ini b/tox.ini
index 86fb62e1..22291748 100644
--- a/tox.ini
+++ b/tox.ini
@@ -90,7 +90,20 @@ deps =
commands = pylint patchwork --rcfile=pylint.rc
[testenv:venv]
-commands = {posargs}
+deps =
+ -rrequirements-dev.txt
+docker =
+ postgres:9.6
+setenv =
+ PW_TEST_DB_TYPE = postgres
+ PW_TEST_DB_USER = postgres
+ PW_TEST_DB_PASS = password
+ PGPASSWORD = password
+dockerenv =
+ POSTGRES_PASSWORD=password
+commands =
+ sleep 5
+ {posargs}
[testenv:coverage]
basepython = python2.7
--
2.20.1
More information about the Patchwork
mailing list