Skip to content

Commit d6ce612

Browse files
committed
docker: Fix compat with latest patchwork/pyenv image
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>
1 parent 60f8be6 commit d6ce612

5 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎docker-compose-pg.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ services:
1919
depends_on:
2020
- db
2121
volumes:
22-
- .:/home/patchwork/patchwork/
22+
- .:/home/ubuntu/patchwork/
2323
ports:
2424
- "8000:8000"
2525
environment:

‎docker-compose-sqlite3.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ services:
99
- GID
1010
command: python3 manage.py runserver 0.0.0.0:8000
1111
volumes:
12-
- .:/home/patchwork/patchwork/
12+
- .:/home/ubuntu/patchwork/
1313
ports:
1414
- "8000:8000"
1515
environment:
1616
- UID
1717
- GID
1818
- DATABASE_TYPE=sqlite3
19-
- DATABASE_NAME=/home/patchwork/patchwork/tools/docker/db/db.sqlite3
19+
- DATABASE_NAME=/home/ubuntu/patchwork/tools/docker/db/db.sqlite3

‎docker-compose.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
depends_on:
2525
- db
2626
volumes:
27-
- .:/home/patchwork/patchwork/
27+
- .:/home/ubuntu/patchwork/
2828
ports:
2929
- "8000:8000"
3030
environment:

‎tools/docker/Dockerfile‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
FROM ghcr.io/getpatchwork/pyenv:latest
22

3+
# Match the host user's UID so the container can write to bind-mounted volumes.
4+
# Ubuntu 24.04 ships with an 'ubuntu' user (UID 1000); we just remap it.
35
ARG UID=1000
46
ARG GID=1000
7+
RUN usermod -u "${UID}" -g "${GID}" ubuntu && chown -R ubuntu:ubuntu /home/ubuntu
58

69
ARG TZ="Australia/Canberra"
710
ENV DEBIAN_FRONTEND noninteractive
811
ENV PYTHONUNBUFFERED 1
9-
ENV PROJECT_HOME /home/patchwork/patchwork
12+
ENV PROJECT_HOME /home/ubuntu/patchwork
1013
ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev
1114

12-
RUN groupadd -o --gid=$GID patchwork && \
13-
useradd --uid=$UID --gid=$GID --create-home patchwork
1415
RUN rm -f /etc/localtime; ln -s /usr/share/zoneinfo/$TZ /etc/localtime
1516

1617
RUN eval "$(pyenv init -)"
@@ -37,5 +38,5 @@ RUN pip install -r /opt/requirements-dev.txt
3738
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
3839
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
3940
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
40-
USER patchwork
41-
WORKDIR /home/patchwork/patchwork
41+
USER ubuntu
42+
WORKDIR /home/ubuntu/patchwork

‎tools/docker/entrypoint.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ test_database() {
4040

4141
# check if patchwork is mounted. Checking if we exist is a
4242
# very good start!
43-
if [ ! -f ~patchwork/patchwork/tools/docker/entrypoint.sh ]; then
43+
if [ ! -f ~/patchwork/tools/docker/entrypoint.sh ]; then
4444
cat << EOF
4545
The patchwork directory doesn't seem to be mounted!
4646
4747
Are you using docker-compose? If so, you may need to create an SELinux rule.
4848
Refer to the development installation documentation for more information.
49-
If not, you need -v PATH_TO_PATCHWORK:/home/patchwork/patchwork
49+
If not, you need -v PATH_TO_PATCHWORK:/home/ubuntu/patchwork
5050
EOF
5151
exit 1
5252
fi

0 commit comments

Comments
 (0)