this repo has no description

Add UID and GID arguments to Dockerfile

This lets you specify the UID and GID of the `git` user during build.
The repository and app directories are owned by this `git` user.

Changed files
+17 -1
+6 -1
Dockerfile
···
label org.opencontainers.image.vendor='tangled.sh'
label org.opencontainers.image.licenses='MIT'
+
arg UID=1000
+
arg GID=1000
+
copy rootfs .
run chmod 755 /etc
run chmod -R 755 /etc/s6-overlay
run apk add shadow s6-overlay execline openssl openssh git curl bash
-
run useradd -d /home/git git && openssl rand -hex 16 | passwd --stdin git
+
run groupadd -g $GID -f git
+
run useradd -u $UID -g $GID -d /home/git git
+
run openssl rand -hex 16 | passwd --stdin git
run mkdir -p /home/git/repositories && chown -R git:git /home/git
copy --from=builder /usr/bin/knot /usr/bin
run mkdir /app && chown -R git:git /app
+11
readme.md
···
The command above for example will build the latest commit on the `master`
branch.
+
By default it will also create a `git` user with user and group ID 1000:1000,
+
but you can change it with the `UID` and `GID` build arguments.
+
+
```sh
+
docker build -t knot:latest --build-arg UID=(id -u) GID=(id -u)
+
```
+
+
The command above for example will create a user with the host user's UID and GID.
+
This is useful if you are bind mounting the repositories and app folder on the host,
+
as in the provided `docker-compose.yml` file.
+
<hr style="margin-bottom: 20px; margin-top: 10px" />
When using compose, it can be specified as a build argument which will be