]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
docker: Require GID also
authorStephen Finucane <stephen@that.guru>
Tue, 15 Oct 2019 12:41:20 +0000 (13:41 +0100)
committerStephen Finucane <stephen@that.guru>
Thu, 17 Oct 2019 11:02:39 +0000 (12:02 +0100)
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 <stephen@that.guru>
docker-compose.yml
tools/docker/Dockerfile

index 90b24c22edd84f81dcb10fe21a88b3cf693331dd..1762d4a6e09f439834a7b94ce3e13888b24f06aa 100644 (file)
@@ -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
index 550871b607f23557d94481ddb59e8348aa9a13e1..61678134d4180dbe20e85e635b39a872b4907bff 100644 (file)
@@ -1,11 +1,13 @@
 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 [ -n "$UID" ] || { echo "You must define UID in .env" 1>&2; exit 1; }
+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 TZ="Australia/Canberra"
 ENV LANG="C.UTF-8"
@@ -18,8 +20,9 @@ ENV PYTHONUNBUFFERED 1
 ENV PROJECT_HOME /home/patchwork/patchwork
 ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev
 
-RUN useradd --uid=$UID --create-home patchwork
-RUN rm /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
+RUN groupadd --gid=$GID patchwork && \
+    useradd --uid=$UID --gid=$GID --create-home patchwork
+RUN rm -f /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
 
 RUN apt-get update && apt-get install -y --no-install-recommends \
     build-essential \