diff mbox series

[3/3] docker: Require GID also

Message ID 20191016121014.29201-3-stephen@that.guru
State Superseded
Headers show
Series [1/3] docker: Rely on caching | expand

Commit Message

Stephen Finucane Oct. 16, 2019, 12:10 p.m. UTC
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      | 2 ++
 tools/docker/Dockerfile | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 \