]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
docker: Fix compat with latest patchwork/pyenv image
authorStephen Finucane <stephen@that.guru>
Sat, 6 Jun 2026 12:04:43 +0000 (13:04 +0100)
committerStephen Finucane <stephenfinucane@hotmail.com>
Sun, 7 Jun 2026 15:10:53 +0000 (16:10 +0100)
We switched to the Ubuntu 24.04 base image some time back. This includes
an ubuntu user that conflicts with the patchwork user we were creating.
Simplify this by using the ubuntu user instead.

Signed-off-by: Stephen Finucane <stephen@that.guru>
docker-compose-pg.yml
docker-compose-sqlite3.yml
docker-compose.yml
tools/docker/Dockerfile
tools/docker/entrypoint.sh

index 3e277e5cf7f4ca9ce3fbdfc1b4831b6774813a06..57db07a24898f145fc8cc4ca2a816ce6db4e1482 100644 (file)
@@ -19,7 +19,7 @@ services:
     depends_on:
       - db
     volumes:
-      - .:/home/patchwork/patchwork/
+      - .:/home/ubuntu/patchwork/
     ports:
       - "8000:8000"
     environment:
index 900cb71fdca422ab61cd4f483c8ed9fa77c4ee83..f3e2622cac4301e9171d1b0c6ad3f41e18d6752a 100644 (file)
@@ -9,11 +9,11 @@ services:
         - GID
     command: python3 manage.py runserver 0.0.0.0:8000
     volumes:
-      - .:/home/patchwork/patchwork/
+      - .:/home/ubuntu/patchwork/
     ports:
       - "8000:8000"
     environment:
       - UID
       - GID
       - DATABASE_TYPE=sqlite3
-      - DATABASE_NAME=/home/patchwork/patchwork/tools/docker/db/db.sqlite3
+      - DATABASE_NAME=/home/ubuntu/patchwork/tools/docker/db/db.sqlite3
index 61c61865f8d8c826fd34de29337a4e910666a45c..86b03f394d3c23801577248c6cd8fc5184c4d9bd 100644 (file)
@@ -24,7 +24,7 @@ services:
     depends_on:
       - db
     volumes:
-      - .:/home/patchwork/patchwork/
+      - .:/home/ubuntu/patchwork/
     ports:
       - "8000:8000"
     environment:
index 6d942492ee64e498db8071f89058b107cd22450f..ad41bc2bf8e5e8768c4e23d7bf32dab60245bc53 100644 (file)
@@ -1,16 +1,17 @@
 FROM ghcr.io/getpatchwork/pyenv:latest
 
+# Match the host user's UID so the container can write to bind-mounted volumes.
+# Ubuntu 24.04 ships with an 'ubuntu' user (UID 1000); we just remap it.
 ARG UID=1000
 ARG GID=1000
+RUN groupmod -g "${GID}" ubuntu && usermod -u "${UID}" ubuntu && chown -R ubuntu:ubuntu /home/ubuntu
 
 ARG TZ="Australia/Canberra"
 ENV DEBIAN_FRONTEND noninteractive
 ENV PYTHONUNBUFFERED 1
-ENV PROJECT_HOME /home/patchwork/patchwork
+ENV PROJECT_HOME /home/ubuntu/patchwork
 ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev
 
-RUN groupadd -o --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 eval "$(pyenv init -)"
@@ -37,5 +38,5 @@ RUN pip install -r /opt/requirements-dev.txt
 COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
-USER patchwork
-WORKDIR /home/patchwork/patchwork
+USER ubuntu
+WORKDIR /home/ubuntu/patchwork
index c78c0581f1b52f8f892e0ddbbdda97716965bcbb..f141b723531dd14654786ef7ee62d389fe230ce5 100755 (executable)
@@ -40,13 +40,13 @@ test_database() {
 
 # check if patchwork is mounted. Checking if we exist is a
 # very good start!
-if [ ! -f ~patchwork/patchwork/tools/docker/entrypoint.sh ]; then
+if [ ! -f ~/patchwork/tools/docker/entrypoint.sh ]; then
     cat << EOF
 The patchwork directory doesn't seem to be mounted!
 
 Are you using docker-compose? If so, you may need to create an SELinux rule.
 Refer to the development installation documentation for more information.
-If not, you need -v PATH_TO_PATCHWORK:/home/patchwork/patchwork
+If not, you need -v PATH_TO_PATCHWORK:/home/ubuntu/patchwork
 EOF
     exit 1
 fi