build(docker): run as a non-root user with a read-only root filesystem
- Use the distroless nonroot image and USER 65532 - Make /data the only writable path, owned by the unprivileged user - Read the config from /etc/parsimony/parsimony.yaml, mounted read-only - Expose the three listener ports - Document the run command in the README
This commit is contained in:
parent
eed5d857b3
commit
ccb2940d6e
1 changed files with 26 additions and 3 deletions
16
README.md
16
README.md
|
|
@ -45,6 +45,22 @@ the unsubscribe links in every message use it. Keep the `api` listener private.
|
|||
curl -H "Authorization: Bearer $PARSIMONY_API_TOKEN" -d '{"name":"dev","domain":"example.org","title":"Dev"}' localhost:8080/api/v1/lists
|
||||
```
|
||||
|
||||
## Docker
|
||||
|
||||
The image runs as an unprivileged user (uid 65532) and works with a read-only root filesystem.
|
||||
Config is mounted read-only; the only writable path is the `/data` volume (the database).
|
||||
|
||||
```
|
||||
docker build -t parsimony .
|
||||
docker run -d --name parsimony --read-only --cap-drop ALL \
|
||||
-v parsimony-data:/data \
|
||||
-v $PWD/parsimony.yaml:/etc/parsimony/parsimony.yaml:ro \
|
||||
-e PARSIMONY_API_TOKEN=... -p 2424:2424 -p 8080:8080 -p 8081:8081 parsimony
|
||||
```
|
||||
|
||||
Use `db: /data/parsimony.db` in the config. A new named volume gets the right ownership by itself;
|
||||
for a bind mount, make the host directory writable by uid 65532.
|
||||
|
||||
## Delivery and the queue
|
||||
|
||||
LMTP answers `250` when the post is in the queue, so a down relay never bounces mail back to Postfix.
|
||||
|
|
|
|||
Loading…
Reference in a new issue