Skip to content

Commit

Permalink
docker: Make .env file optional
Browse files Browse the repository at this point in the history
I now have a standard UID and GID of 1000, making this file unnecessary.

Signed-off-by: Stephen Finucane <[email protected]>
  • Loading branch information
stephenfin committed Jul 12, 2024
1 parent ffbd322 commit 3e5bb7e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 24 deletions.
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
22 changes: 8 additions & 14 deletions docs/development/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 2 additions & 8 deletions tools/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 3e5bb7e

Please sign in to comment.