From 3e5bb7e1b28b8221f6b77f9b1ba22b3503a1fc04 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 12 Jul 2024 14:32:43 +0100 Subject: [PATCH] docker: Make .env file optional I now have a standard UID and GID of 1000, making this file unnecessary. Signed-off-by: Stephen Finucane --- README.rst | 7 +++++-- docs/development/installation.rst | 22 ++++++++-------------- tools/docker/Dockerfile | 10 ++-------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/README.rst b/README.rst index 979801fb3..ebde1f363 100644 --- a/README.rst +++ b/README.rst @@ -85,11 +85,14 @@ environment. To install Patchwork: $ git clone https://github.com/getpatchwork/patchwork.git -3. Create a ``.env`` file in the root directory of the project and store your - ``UID`` and ``GID`` attributes there:: +3. (Optional) Create a ``.env`` file in the root directory of the project and + store your ``UID`` and ``GID`` attributes there:: $ cd patchwork && printf "UID=$(id -u)\nGID=$(id -g)\n" > .env + This should only be necessary if you have a ``UID`` or ``GID`` other than + ``1000``. + 4. Build the images. This will download a number of packages from the internet, and compile several versions of Python:: diff --git a/docs/development/installation.rst b/docs/development/installation.rst index 6f4920a62..c33f768b1 100644 --- a/docs/development/installation.rst +++ b/docs/development/installation.rst @@ -30,14 +30,20 @@ configure Patchwork using Docker: package. __ post-install_ -#. Create a ``.env`` file in the root directory of the project and store your - ``UID`` and ``GID`` attribute there. +#. (Optional) Create a ``.env`` file in the root directory of the project and + store your ``UID`` and ``GID`` attribute there. .. code-block:: shell $ echo "UID=$UID" > .env $ echo "GID=`id -g`" >> .env + This should only be necessary if you have a ``UID`` or ``GID`` other than + ``1000``. For more information on why this is necessary, refer to this + `docker-compose issue`__. + + __ https://github.com/docker/compose/issues/2380 + #. Build the images. This will download over 200MB from the internet: .. code-block:: shell @@ -140,18 +146,6 @@ For more information on Docker itself, please refer to the `docker`_ and __ post-install_ -.. note:: - - If you see an error like the below:: - - You must define UID in .env - - Ensure you have created a ``.env`` file in the root of your project - directory and stored the ``UID`` attribute there. For more information on - why this is necessary, refer to this `docker-compose issue`__. - - __ https://github.com/docker/compose/issues/2380 - .. _docker: https://docs.docker.com/engine/install/ .. _docker-compose: https://docs.docker.com/compose/install/ .. _post-install: https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index bdae67a27..0a55b54db 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -1,13 +1,7 @@ FROM ghcr.io/getpatchwork/pyenv:latest -ARG UID -ARG GID - -# make sure the user has configured the '.env' file and quick fail if not - -RUN echo $UID; echo $GID; \ - [ -n "$UID" ] || { echo "You must define UID in .env" 1>&2; exit 1; }; \ - [ -n "$GID" ] || { echo "You must define GID in .env" 1>&2; exit 1; } +ARG UID=1000 +ARG GID=1000 ARG TZ="Australia/Canberra" ENV DEBIAN_FRONTEND noninteractive