From patchwork Tue Sep 3 17:03:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1157169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46NCw13hJLz9s00 for ; Wed, 4 Sep 2019 03:03:45 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="qtvGfbWg"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46NCw12jqXzDqpy for ; Wed, 4 Sep 2019 03:03:45 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=172.82.139.79; helo=qrelay79.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="qtvGfbWg"; dkim-atps=neutral Received: from qrelay79.mxroute.com (qrelay79.mxroute.com [172.82.139.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46NCvb5cGJzDqN8 for ; Wed, 4 Sep 2019 03:03:23 +1000 (AEST) Received: from filter002.mxroute.com (unknown [116.203.155.46]) by qrelay79.mxroute.com (Postfix) with ESMTP id B2611E07F1; Tue, 3 Sep 2019 13:03:20 -0400 (EDT) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id 1FE303F346; Tue, 3 Sep 2019 17:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=fYl5bSlC40HaMTEfXfeP3e/joLnlxchM/8QZOZ8CCGU=; b=qtvGfbWgehq0YA8nCS/dRGAKCT hSM5WWomHI5fYQ94mep763e3lsXhry3hbC+hod8tmok5OmdsdIfIzeuTfvC0KdhqdkuGQHkAqhe8J 19+3KkM07P+EteYzckwy6qe1uFu3Uljhc5I0VJfiwFMxkQN7cKr6tfHlnuA6puVZ3ZPr9NoB7Pmft nv5L3AeWk8BRmDGahrePTdYf6AwTiKAOogWn1lnXKfPJjpJB5JVZ9ukSn1cPr+cUB3jKFqizabQiZ YQj//NSLRQwximv0rFANMn3lz/sRONDdDGGJLefRM2naMtFQG8UZ7ZZevLLLxuHK/GLbjXNXgRp6Q Gumc88lA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 1/3] Drop support for Python 3.4, add Python 3.7 Date: Tue, 3 Sep 2019 18:03:02 +0100 Message-Id: <20190903170304.24325-1-stephen@that.guru> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" It's no longer supported upstream and the *second* last Ubuntu LTS release provides something newer. Time to move on. Signed-off-by: Stephen Finucane --- README.rst | 4 ++-- docs/development/installation.rst | 6 +++--- requirements-dev.txt | 4 ++-- requirements-prod.txt | 4 ++-- tools/docker/Dockerfile | 5 ++--- tools/docker/trusty-ports.list | 3 --- tools/docker/trusty.list | 3 --- tox.ini | 4 ++-- 8 files changed, 13 insertions(+), 20 deletions(-) delete mode 100644 tools/docker/trusty-ports.list delete mode 100644 tools/docker/trusty.list diff --git a/README.rst b/README.rst index b45c3e6a..01da4196 100644 --- a/README.rst +++ b/README.rst @@ -41,9 +41,9 @@ of community projects. Requirements ------------ -- Python (2.7, 3.4 - 3.6) +- Python (2.7, 3.5 - 3.7) -- Django (1.11 - 2.0) +- Django (1.11 - 2.2) - Django REST Framework (3.6 - 3.9) diff --git a/docs/development/installation.rst b/docs/development/installation.rst index 0ab755f4..ed9ceb13 100644 --- a/docs/development/installation.rst +++ b/docs/development/installation.rst @@ -165,7 +165,7 @@ Python Requirements ^^^^^^^^^^^^^^^^^^^ To develop Python-based software you first need Python. Patchwork supports both -Python 2.7 and Python 3.4+. One of these will be installed by default on many +Python 2.7 and Python 3.5+. One of these will be installed by default on many installations, though they can also be installed manually using the ``python`` or ``python3`` packages. @@ -224,7 +224,7 @@ An example for installing all these packages and the MySQL RDBMS on Ubuntu python-tox mysql-server libmysqlclient-dev If you have an existing MariaDB/MySQL installation and have installed ``pip`` -already/are using Python 3.4+ then you can install all packages using ``pip``: +already/are using Python 3.5+ then you can install all packages using ``pip``: .. code-block:: shell @@ -254,7 +254,7 @@ virtual environment. This can be done like so: .. note:: If you installed a Python 3.x-based virtual environment package, adjust the - executable indicated above as necessary, e.g. ``virtualenv-3.4``. + executable indicated above as necessary, e.g. ``virtualenv-3.7``. Now install the packages. Patchwork provides three requirements files. diff --git a/requirements-dev.txt b/requirements-dev.txt index ce637549..ec539a6d 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,7 +1,7 @@ -Django==2.2.3; python_version >= '3.4' +Django==2.2.3; python_version >= '3.5' Django==1.11.22; python_version < '3.0' # pyup: ignore djangorestframework==3.9.2 -django-filter==2.1.0; python_version >= '3.4' +django-filter==2.1.0; python_version >= '3.5' django-filter==1.1.0; python_version < '3.0' # pyup: ignore django-debug-toolbar==1.11 django-dbbackup==3.2.0 diff --git a/requirements-prod.txt b/requirements-prod.txt index 13499785..c9bf1044 100644 --- a/requirements-prod.txt +++ b/requirements-prod.txt @@ -1,7 +1,7 @@ -Django==2.2.3; python_version >= '3.4' +Django==2.2.3; python_version >= '3.5' Django==1.11.22; python_version < '3.0' # pyup: ignore djangorestframework==3.9.2 -django-filter==2.1.0; python_version >= '3.4' +django-filter==2.1.0; python_version >= '3.5' django-filter==1.1.0; python_version < '3.0' # pyup: ignore psycopg2-binary==2.8.2 sqlparse==0.3.0 diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 76bb6b2b..81700711 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -17,14 +17,13 @@ ENV PYTHONUNBUFFERED 1 # System -# trusty and findutils is for python3.4; xenial is for python3.5 +# 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; \ @@ -34,7 +33,7 @@ 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 \ + python3.6-dev \ libmysqlclient-dev mysql-client curl unzip build-essential \ git postgresql-client tzdata libpq-dev 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/tox.ini b/tox.ini index bfca0538..7742d1b8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 2.0 -envlist = pep8,docs,py{27,34}-django111,py{35,36}-django{111,20,21,22} +envlist = pep8,docs,py{27}-django111,py{35,36,37}-django{111,20,21,22} skipsdist = True [testenv] @@ -8,7 +8,7 @@ deps = -r{toxinidir}/requirements-test.txt django111: django>=1.11,<2.0 django111: djangorestframework>=3.6,<3.10 - django111: django-filter>=1.0,<3.0; python_version >= '3.4' + django111: django-filter>=1.0,<3.0; python_version >= '3.5' django111: django-filter>=1.0,<2.0; python_version < '3.0' django20: django>=2.0,<2.1 django21: django>=2.1,<2.2 From patchwork Tue Sep 3 17:03:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1157170 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46NCwR5FsWz9sBF for ; Wed, 4 Sep 2019 03:04:07 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="nIAxPU+h"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46NCwQ4pbfzDqTh for ; Wed, 4 Sep 2019 03:04:06 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=172.82.139.106; helo=qrelay106.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="nIAxPU+h"; dkim-atps=neutral Received: from qrelay106.mxroute.com (qrelay106.mxroute.com [172.82.139.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46NCvc5cvczDqHR for ; Wed, 4 Sep 2019 03:03:24 +1000 (AEST) Received: from filter002.mxroute.com (unknown [94.130.183.33]) by qrelay106.mxroute.com (Postfix) with ESMTP id 90EB61008B1; Tue, 3 Sep 2019 13:03:21 -0400 (EDT) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter002.mxroute.com (Postfix) with ESMTPS id C83F33F348; Tue, 3 Sep 2019 17:03:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=29cRFVtI0cDjfiLN+aDuxKThn26RiMeMrGvO6sVbNoY=; b=nIAxPU+hauTG3ALvjhwOHj1K+n uXHbXiiXIl3jCzwoniJuBckmj5L7K5wmaqp4nqlMUUn9B1ysqiHXme5ZmBigkqfNIKqRwUzLh0L0P 5G1WjbcIXPq8kCOuV9uy0xmDBO61BaMTiub9SsZH+vFZXRm08GjwpvNfst/bSnfN+VHxPRQsp78OY pkpRXSfrZXHr2wUX93//4LYINKh7wD6l08R7VvT0PS6K5I2EGYedfZC65ZniDGgQZ0ASJ9jKvxiC2 //a8bLFWzgoWvoMyxRiF/awFUnbVQ0hdDUFd97Q75rc6d/THFMHPkdfNXTuNSK8bxXkwieZZRbwQ5 rj56EPJA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 2/3] docker: Simplify MySQL reset Date: Tue, 3 Sep 2019 18:03:03 +0100 Message-Id: <20190903170304.24325-2-stephen@that.guru> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190903170304.24325-1-stephen@that.guru> References: <20190903170304.24325-1-stephen@that.guru> MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" Just use the hardcoded configuration. Signed-off-by: Stephen Finucane --- tools/docker/Dockerfile | 3 --- tools/docker/entrypoint.sh | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index 81700711..556085ce 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -8,9 +8,6 @@ RUN [ -n "$UID" ] || { echo "You must define UID in .env" 1>&2; exit 1; } ENV PROJECT_HOME /home/patchwork/patchwork -ENV db_user root -ENV db_pass password - ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev ENV DEBIAN_FRONTEND noninteractive ENV PYTHONUNBUFFERED 1 diff --git a/tools/docker/entrypoint.sh b/tools/docker/entrypoint.sh index d2b094bd..08fa1906 100755 --- a/tools/docker/entrypoint.sh +++ b/tools/docker/entrypoint.sh @@ -22,7 +22,7 @@ test_database() { } reset_data_mysql() { - mysql -u$db_user -p$db_pass -h $PW_TEST_DB_HOST << EOF + mysql -uroot -ppassword -h $PW_TEST_DB_HOST << EOF DROP DATABASE IF EXISTS patchwork; CREATE DATABASE patchwork CHARACTER SET utf8; GRANT ALL ON patchwork.* TO 'patchwork' IDENTIFIED BY 'password'; From patchwork Tue Sep 3 17:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1157168 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46NCvh3scvz9s00 for ; Wed, 4 Sep 2019 03:03:28 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="grcTdSZi"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46NCvh0F9LzDqWv for ; Wed, 4 Sep 2019 03:03:28 +1000 (AEST) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=that.guru (client-ip=172.82.139.186; helo=qrelay186.mxroute.com; envelope-from=stephen@that.guru; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=that.guru Authentication-Results: lists.ozlabs.org; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=that.guru header.i=@that.guru header.b="grcTdSZi"; dkim-atps=neutral Received: from qrelay186.mxroute.com (qrelay186.mxroute.com [172.82.139.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46NCvb1H1gzDqHR for ; Wed, 4 Sep 2019 03:03:22 +1000 (AEST) Received: from filter001.mxrelay.co (unknown [94.130.183.33]) by qrelay186.mxroute.com (Postfix) with ESMTP id D43B7160507; Tue, 3 Sep 2019 13:03:18 -0400 (EDT) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter001.mxrelay.co (Postfix) with ESMTPS id AFE1A1001C9; Tue, 3 Sep 2019 17:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=that.guru; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=yKiVMPsLk2kDl22HGw0HWOuCeJaZLeEURo4WhSYIoZE=; b=grcTdSZiheT5TqBiDWeAj0WdKO hegFnPFR5+AxiEj4VvAieQPaAM2Ik2iP2FvNGjbHl2L87kTvSWD8AQoB0jWpZIUk20UeOFPCw1qJO E0ex4ogueehMki9UuOyj7S8UZCYit00VvLaRVHa6UaVwKAqD0y4tmITEhjFH6eHekk+hdYF7JJB0O z+d3zX55r2sbbR0fovmwGMTzeUle3BP71l8Jeq/sCjETKBTaEUnqOm6oloVC3srTzoKlQq3kkjFFZ rRsbw/uGDGPN5bn9mmJr8IzmAWtn7bm74o5RCK6JAYTN3p9OS30uElAo5EnVVZZwZWb/EJTsh2D3P PnBhzAGw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 3/3] docker: Use pyenv for Python versions Date: Tue, 3 Sep 2019 18:03:04 +0100 Message-Id: <20190903170304.24325-3-stephen@that.guru> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190903170304.24325-1-stephen@that.guru> References: <20190903170304.24325-1-stephen@that.guru> MIME-Version: 1.0 X-AuthUser: stephen@that.guru X-BeenThere: patchwork@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Patchwork development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: patchwork-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Patchwork" This is slightly slower to initially configure but requires less hacking to get the same environment and should be a lot more maintainable (just a simple modification to change the Python version). Signed-off-by: Stephen Finucane --- tools/docker/Dockerfile | 79 ++++++++++++++++++---------------- tools/docker/entrypoint.sh | 10 ++--- tools/docker/xenial-ports.list | 3 -- tools/docker/xenial.list | 3 -- 4 files changed, 47 insertions(+), 48 deletions(-) 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 556085ce..35324b13 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -1,54 +1,59 @@ FROM ubuntu:18.04 ARG UID -ARG TZ="Australia/Canberra" + +# make sure the user has configured the '.env' file and quick fail if not RUN echo $UID RUN [ -n "$UID" ] || { echo "You must define UID in .env" 1>&2; exit 1; } -ENV PROJECT_HOME /home/patchwork/patchwork - -ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev +ARG TZ="Australia/Canberra" +ENV LANG="C.UTF-8" +ENV LC_ALL="C.UTF-8" +ENV PATH="/opt/pyenv/shims:/opt/pyenv/bin:$PATH" +ENV PYENV_ROOT="/opt/pyenv" +ENV PYENV_SHELL="bash" ENV DEBIAN_FRONTEND noninteractive ENV PYTHONUNBUFFERED 1 +ENV PROJECT_HOME /home/patchwork/patchwork +ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev - -# System -# 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 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.6-dev \ - libmysqlclient-dev mysql-client curl unzip build-essential \ - git postgresql-client tzdata libpq-dev - -# User RUN useradd --uid=$UID --create-home patchwork - -# Timezone RUN rm /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime -# Python requirements. -# If you update requirements, you should rebuild the container. -# entrypoint.sh will prompt you to do this. -# we install both Python 2 and Python 3 versions so you can use either +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + curl \ + git \ + libbz2-dev \ + libffi-dev \ + libmysqlclient-dev \ + libpq-dev \ + libreadline-dev \ + libsqlite3-dev \ + libssl1.0-dev \ + mysql-client \ + postgresql-client \ + tzdata \ + zlib1g-dev \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash && \ + git clone https://github.com/momo-lab/xxenv-latest $PYENV_ROOT/plugins/xxenv-latest && \ + pyenv update + +RUN pyenv latest install 2.7 && \ + pyenv latest install 3.5 && \ + pyenv latest install 3.6 && \ + pyenv latest install 3.7 + +RUN pyenv global $(pyenv versions --bare | tac) + 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 +RUN pip install tox tox-pyenv && \ + pip 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 08fa1906..456d640d 100755 --- a/tools/docker/entrypoint.sh +++ b/tools/docker/entrypoint.sh @@ -46,10 +46,10 @@ reset_data() { fi # load initial data - python3 $PROJECT_HOME/manage.py migrate #> /dev/null - python3 $PROJECT_HOME/manage.py loaddata default_tags #> /dev/null - python3 $PROJECT_HOME/manage.py loaddata default_states #> /dev/null - python3 $PROJECT_HOME/manage.py loaddata default_projects #> /dev/null + python manage.py migrate #> /dev/null + python manage.py loaddata default_tags #> /dev/null + python manage.py loaddata default_states #> /dev/null + python manage.py loaddata default_projects #> /dev/null } # the script begins! @@ -126,7 +126,7 @@ elif [ "$1" == "--shell" ]; then exec bash elif [ "$1" == "--test" ] || [ "$1" == "--quick-test" ]; then shift - python3 manage.py test $@ + python manage.py test $@ elif [ "$1" == "--tox" ] || [ "$1" == "--quick-tox" ]; then shift tox $@ 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