Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Mar 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
nrwiersma marked this conversation as resolved.
Show resolved Hide resolved

EXPOSE 3000

ENTRYPOINT [ "/sbin/tini", "--" ]
Expand Down
17 changes: 17 additions & 0 deletions docs/content/install/using-docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `authens` 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

Expand Down