feat: add non-root user to docker image (#1843)

This commit is contained in:
Nicholas Wiersma
2023-03-09 06:13:01 +02:00
committed by GitHub
parent 5099b30ac6
commit 96f7cb8975
2 changed files with 20 additions and 0 deletions
+3
View File
@@ -32,6 +32,9 @@ RUN chmod 644 /config/config.toml
RUN apk add --update git git-lfs mercurial openssh-client subversion procps fossil tini && \
mkdir -p /usr/local/go
ARG USER=athens
RUN adduser -D -h /home/$USER $USER
EXPOSE 3000
ENTRYPOINT [ "/sbin/tini", "--" ]
+17
View File
@@ -53,6 +53,23 @@ docker run -d -v "$($env:ATHENS_STORAGE):/var/lib/athens" `
gomods/athens:latest
```
## Non-Root User
The Athens docker images comes with a non-root user `athens` with `uid: 1000`, `gid: 1000` and home directory `/home/athens`.
In situations where running as root is not permitted, this user can be used instead. In all other instuctions
replace `/root/` with `/home/athens/` and set the user and group ids in the run environment to `1000`.
```shell
docker run -d -v $ATHENS_STORAGE:/var/lib/athens \
-e ATHENS_DISK_STORAGE_ROOT=/var/lib/athens \
-e ATHENS_STORAGE_TYPE=disk \
-v "$PWD/gitconfig/.gitconfig:/home/athens/.gitconfig" \
--name athens-proxy \
--restart always \
-p 3000:3000 \
-u 1000:1000 \
gomods/athens:latest
```
## Troubleshooting Athens in Docker