Skip to content

Commit 2ab1dad

Browse files
authored
build: simplify pip-compile Docker wrapper by fixing root perm issue (#257)
We just delete the `requirements.txt` file prior its regeneration. Updating an existing file causes permission issues. Creating a new one does not. This Docker documentation section helps me spotting this: https://docs.docker.com/engine/storage/bind-mounts/#start-a-container-with-a-bind-mount.
1 parent f0858cf commit 2ab1dad

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

docs/user-guide/requirements/pip-compile/Dockerfile

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
# Note: impossible to rely on v3.13.14 (missing 'cache_clear' function error)
55
FROM docker.io/python:3.12.11-alpine@sha256:c610e4a94a0e8b888b4b225bfc0e6b59dee607b1e61fb63ff3926083ff617216
66

7-
ARG UID
8-
ARG GID
9-
107
# BusyBox command help: https://www.busybox.net/downloads/BusyBox.html
11-
RUN addgroup -S -g ${GID} pip && \
12-
adduser -S -u ${UID} -G pip pip
8+
RUN addgroup -S pip && \
9+
adduser -S -G pip pip
1310

1411
USER pip
1512

docs/user-guide/requirements/pip-compile/pip-compile.sh

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ case "$(uname)" in
2323
esac
2424

2525
echo 'Building Docker image for pip-tools (should only take few seconds)'
26-
docker build --progress quiet \
27-
--build-arg "UID=$(id -u)" \
28-
--build-arg "GID=$(id -g)" \
29-
-t docker-papermc-server/pip-tools \
30-
"${SCRIPT_DIR}"
26+
docker build --progress quiet -t docker-papermc-server/pip-tools "${SCRIPT_DIR}"
27+
28+
echo 'Cleaning up old requirements.txt file'
29+
rm "${CURRENT_DIR}"/requirements.txt
3130

3231
echo
3332
echo 'Running pip-compile:'

0 commit comments

Comments
 (0)