From patchwork Wed Oct 16 12:10:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1177847 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 46tWPH5jGrz9sP7 for ; Wed, 16 Oct 2019 23:11:47 +1100 (AEDT) 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="agdw8HEY"; 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 46tWPH4kSNzDqcy for ; Wed, 16 Oct 2019 23:11:47 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=172.82.139.144; helo=qrelay144.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="agdw8HEY"; dkim-atps=neutral Received: from qrelay144.mxroute.com (qrelay144.mxroute.com [172.82.139.144]) (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 46tWNm6S6qzDqFv for ; Wed, 16 Oct 2019 23:11:20 +1100 (AEDT) Received: from filter004.mxroute.com (unknown [116.203.155.46]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by qrelay144.mxroute.com (Postfix) with ESMTPS id 1180B1209A2; Wed, 16 Oct 2019 08:11:17 -0400 (EDT) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter004.mxroute.com (Postfix) with ESMTPS id EF6423F4ED; Wed, 16 Oct 2019 12:11:14 +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=VDqcVgPWi5rkIxNrrJH8tIYpOgI3i+dyvd/hiZ2WA8Q=; b=agdw8HEYM31BTIwLgjEXuJm9IM nwAi5yr133MwCOmgtdaDZEiWht/2D5KNjwNq0wDnTQOXQzwQfrwg29NynW2tnOEnaWTwPdwi+xVI2 Qq5QCHupkKOe8nxNxvmxzKUOxisBGQ/pUzf6OsIantiQHqp083FoFF4hmSqjGRl0oKE/F02yN6lcl tzxZqf5qUlORfRonHzjJ9EKKfq4g+XcqU0xqlCJycO25ee2WoNjBqDV1+BLhMFtvvwMhPEv1mu72R BgpQDHRGIl11GmUaKrUAl+MRGUbxGR4WF2jTEOlq6ziiJWOFrxOIzGs/Byhk76hWqDg5HnRS7uQO3 bvj7cGnw==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 1/3] docker: Rely on caching Date: Wed, 16 Oct 2019 13:10:12 +0100 Message-Id: <20191016121014.29201-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 seems less likely that tox and tox-pyenv will change than our requirements. Split up the 'RUN' steps so we don't have to reinstall the former every time the latter change. Signed-off-by: Stephen Finucane --- tools/docker/Dockerfile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git tools/docker/Dockerfile tools/docker/Dockerfile index 35324b13..a8e85ef0 100644 --- tools/docker/Dockerfile +++ tools/docker/Dockerfile @@ -47,15 +47,12 @@ 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 pip install tox tox-pyenv && \ - pip install -r /tmp/requirements-dev.txt +RUN pip install tox tox-pyenv -# we deliberately leave the requirements files in tmp so we can -# ping the user in entrypoint.sh if the change them! +COPY requirements-dev.txt requirements-test.txt /opt/ +RUN pip install -r /opt/requirements-dev.txt COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] From patchwork Wed Oct 16 12:10:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1177846 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 46tWNt38DXz9sP7 for ; Wed, 16 Oct 2019 23:11:26 +1100 (AEDT) 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="hQSMuNta"; 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 46tWNt1YsdzDqdh for ; Wed, 16 Oct 2019 23:11:26 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=199.181.239.174; helo=relay0174.mxlogin.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="hQSMuNta"; dkim-atps=neutral Received: from relay0174.mxlogin.com (relay0174.mxlogin.com [199.181.239.174]) (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 46tWNm3MQ6zDqFC for ; Wed, 16 Oct 2019 23:11:20 +1100 (AEDT) Received: from filter004.mxroute.com (unknown [94.130.183.33]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay0174.mxlogin.com (Postfix) with ESMTPS id BD3EECC6031C; Wed, 16 Oct 2019 07:11:17 -0500 (CDT) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter004.mxroute.com (Postfix) with ESMTPS id 5BE6D3F4EB; Wed, 16 Oct 2019 12:11: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=fpKqmL6xdKYirkOyvo4ZdJArT7m6iReieSHbpJSkahI=; b=hQSMuNtaElxqE71JUH7SYaGN0q kfAsUV3ynfZcu3cKUetpF0SppzNf0HBKzG3lymeO81o0chdRTcYkREb0OhVjImZyBD3Txg2glGlpT 7p/gDz0zRCP1vojPTqEWHeyr94YFSPxAqcu9WQFdFvbF+QPX5eGiYtHLTHOOcF1eZfMBSStQxQvNv 8eudxU03lnopikN8gfy6qT51AF9xFC5mfjXjS86fmEUsKSdWaRCLdN6QtJ71ZtgTSR0jIhx8OdFJY 0XlcWYx2hs9oHVAMesnKcgsNGd8eJSRKw2jcWU2OJnB8i/1MkWKdBdR0/R2DInsvuSbCNe7E96Iq1 yuc3QLbA==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 2/3] docker: Ignore .tox, .backups directories Date: Wed, 16 Oct 2019 13:10:13 +0100 Message-Id: <20191016121014.29201-2-stephen@that.guru> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191016121014.29201-1-stephen@that.guru> References: <20191016121014.29201-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" These can be _huge_ which can significantly slow down the startup time. We don't need them so ignore them. Signed-off-by: Stephen Finucane --- .dockerignore | 2 ++ 1 file changed, 2 insertions(+) diff --git .dockerignore .dockerignore index 216f4ba2..77feb067 100644 --- .dockerignore +++ .dockerignore @@ -1 +1,3 @@ tools/docker/db +.backups +.tox From patchwork Wed Oct 16 12:10:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Finucane X-Patchwork-Id: 1177848 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 46tWPj0KfGz9sP7 for ; Wed, 16 Oct 2019 23:12:09 +1100 (AEDT) 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="TjnFv+9p"; 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 46tWPh5Pf9zDqyq for ; Wed, 16 Oct 2019 23:12:08 +1100 (AEDT) X-Original-To: patchwork@lists.ozlabs.org Delivered-To: patchwork@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=that.guru (client-ip=199.181.239.151; helo=relay0151.mxlogin.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="TjnFv+9p"; dkim-atps=neutral Received: from relay0151.mxlogin.com (relay0151.mxlogin.com [199.181.239.151]) (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 46tWNq6W43zDqFv for ; Wed, 16 Oct 2019 23:11:23 +1100 (AEDT) Received: from filter004.mxroute.com (unknown [116.203.155.46]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay0151.mxlogin.com (Postfix) with ESMTPS id BA811CC40329; Wed, 16 Oct 2019 07:11:20 -0500 (CDT) Received: from one.mxroute.com (one.mxroute.com [195.201.59.211]) by filter004.mxroute.com (Postfix) with ESMTPS id 875283F4ED; Wed, 16 Oct 2019 12:11: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=w9Wu+cTbCMsD+lUPIeoYT+ftuBD0NmNkgZVP6XxPrzk=; b=TjnFv+9pTYNYRvUoFc63XL24LF ijiDKzKuaHVrJbk9smzdA6mWuqRYKXafN83WRkTfzgJyMasocLPTd0gDFOz/QCBzY1Wv2ElhzkJks uM4bUDc3OXoLmznroB9//vlnXsvOT7JRh4jNpZDFQ6UeEukUoRIgtCoVGeCoJicexAXur1Y/6xGdh WkvgbkSxusiLeBXQpTgFfoJEMufSvYy5XwdWsUGMMIwyezrPPygyQyroertwgGGEz+GnP8tKGVPnx SvxUH/3/5yZKmDUyM4QZQ7rMaV9mZdl240x87rrEVkfUuelPyspbngoC7EIhtIQwS7Yt5Lzs3QsAQ wPSjllww==; From: Stephen Finucane To: patchwork@lists.ozlabs.org Subject: [PATCH 3/3] docker: Require GID also Date: Wed, 16 Oct 2019 13:10:14 +0100 Message-Id: <20191016121014.29201-3-stephen@that.guru> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191016121014.29201-1-stephen@that.guru> References: <20191016121014.29201-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" If you don't do this, created files end up with a group of 'gcc' or whatever group has an ID of 1000. Signed-off-by: Stephen Finucane --- docker-compose.yml | 2 ++ tools/docker/Dockerfile | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git docker-compose.yml docker-compose.yml index 90b24c22..1762d4a6 100644 --- docker-compose.yml +++ docker-compose.yml @@ -15,6 +15,7 @@ services: dockerfile: ./tools/docker/Dockerfile args: - UID + - GID depends_on: - db command: python3 manage.py runserver 0.0.0.0:8000 @@ -24,5 +25,6 @@ services: - "8000:8000" environment: - UID + - GID - PW_TEST_DB_HOST=db - PW_TEST_DB_PORT=3306 diff --git tools/docker/Dockerfile tools/docker/Dockerfile index a8e85ef0..4e748756 100644 --- tools/docker/Dockerfile +++ tools/docker/Dockerfile @@ -1,11 +1,14 @@ FROM ubuntu:18.04 ARG UID +ARG GID # make sure the user has configured the '.env' file and quick fail if not RUN echo $UID +RUN echo $GID RUN [ -n "$UID" ] || { echo "You must define UID in .env" 1>&2; exit 1; } +RUN [ -n "$GID" ] || { echo "You must define GID in .env" 1>&2; exit 1; } ARG TZ="Australia/Canberra" ENV LANG="C.UTF-8" @@ -18,7 +21,7 @@ ENV PYTHONUNBUFFERED 1 ENV PROJECT_HOME /home/patchwork/patchwork ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev -RUN useradd --uid=$UID --create-home patchwork +RUN useradd --uid=$UID --gid=$GID --create-home patchwork RUN rm /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime RUN apt-get update && apt-get install -y --no-install-recommends \