Skip to content

Commit 3f3812e

Browse files
committed
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 d28b53e commit 3f3812e

6 files changed

Lines changed: 13 additions & 30 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ jobs:
7373
--health-interval 10s
7474
--health-timeout 5s
7575
--health-retries 5
76+
--gtid-mode=OFF
77+
--enforce-gtid-consistency=OFF
7678
steps:
7779
- name: Checkout source code
7880
uses: actions/checkout@v6
@@ -149,7 +151,7 @@ jobs:
149151
cache: 'pip'
150152
- name: Build docker-compose service
151153
run: |
152-
docker compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g)
154+
docker compose build
153155
- name: Test createsuperuser/changepassword
154156
run: |
155157
docker compose run -T --rm web \

docker-compose-pg.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@ services:
1313
build:
1414
context: .
1515
dockerfile: ./tools/docker/Dockerfile
16-
args:
17-
- UID
18-
- GID
1916
depends_on:
2017
- db
2118
volumes:
22-
- .:/home/patchwork/patchwork/
19+
- .:/home/ubuntu/patchwork/
2320
ports:
2421
- "8000:8000"
2522
environment:
26-
- UID
27-
- GID
2823
- DATABASE_TYPE=postgres
2924
- DATABASE_HOST=db
3025
- DATABASE_PORT=5432

docker-compose-sqlite3.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,11 @@ services:
44
build:
55
context: .
66
dockerfile: ./tools/docker/Dockerfile
7-
args:
8-
- UID
9-
- GID
107
command: python3 manage.py runserver 0.0.0.0:8000
118
volumes:
12-
- .:/home/patchwork/patchwork/
9+
- .:/home/ubuntu/patchwork/
1310
ports:
1411
- "8000:8000"
1512
environment:
16-
- UID
17-
- GID
1813
- DATABASE_TYPE=sqlite3
19-
- DATABASE_NAME=/home/patchwork/patchwork/tools/docker/db/db.sqlite3
14+
- DATABASE_NAME=/home/ubuntu/patchwork/tools/docker/db/db.sqlite3

docker-compose.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
services:
33
db:
44
image: mysql:9.7
5+
command: --gtid-mode=OFF --enforce-gtid-consistency=OFF
56
volumes:
67
- ./tools/docker/db/data:/var/lib/mysql
78
environment:
@@ -18,18 +19,13 @@ services:
1819
build:
1920
context: .
2021
dockerfile: ./tools/docker/Dockerfile
21-
args:
22-
- UID
23-
- GID
2422
depends_on:
2523
- db
2624
volumes:
27-
- .:/home/patchwork/patchwork/
25+
- .:/home/ubuntu/patchwork/
2826
ports:
2927
- "8000:8000"
3028
environment:
31-
- UID
32-
- GID
3329
# skip DATABASE_TYPE explicitly as mysql should be the default type.
3430
- DATABASE_HOST=db
3531
- DATABASE_PORT=3306

tools/docker/Dockerfile

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

3-
ARG UID=1000
4-
ARG GID=1000
5-
63
ARG TZ="Australia/Canberra"
74
ENV DEBIAN_FRONTEND noninteractive
85
ENV PYTHONUNBUFFERED 1
9-
ENV PROJECT_HOME /home/patchwork/patchwork
6+
ENV PROJECT_HOME /home/ubuntu/patchwork
107
ENV DJANGO_SETTINGS_MODULE patchwork.settings.dev
118

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

1611
RUN eval "$(pyenv init -)"
@@ -37,5 +32,5 @@ RUN pip install -r /opt/requirements-dev.txt
3732
COPY tools/docker/entrypoint.sh /usr/local/bin/entrypoint.sh
3833
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
3934
CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
40-
USER patchwork
41-
WORKDIR /home/patchwork/patchwork
35+
USER ubuntu
36+
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)