Consolidate Docker deployment into a single PaperJet container
Some checks failed
CI / Backend (Python) (pull_request) Successful in 23s
CI / Frontend (TypeScript) (pull_request) Successful in 9m32s
CI / Container (Docker) (pull_request) Failing after 54s

This commit is contained in:
Elijah 2026-08-15 11:07:59 -07:00
parent db9e2ca51b
commit 65abb5154e
13 changed files with 290 additions and 151 deletions

View file

@ -6,15 +6,34 @@ PaperJet is a self-hosted, single-user PDF annotation editor. It keeps the uploa
1. Copy `.env.example` to `.env`.
2. Replace `SECRET_KEY` with a long random value. Compose refuses to start without it.
3. Start the stack:
3. Build and start the single-container application:
```sh
docker compose up --build -d
```
Open `http://localhost:4982` (or the value of `HTTP_PORT`). The first visit asks you to create the single master password.
The container serves the React application through nginx and proxies `/api`
requests to the loopback-only FastAPI process. Open `http://localhost:4982`
(or the value of `HTTP_PORT`). The first visit asks you to create the single
master password.
The `db`, `pdf_storage`, and `thumbnails` volumes contain application data. Back them up before maintenance or upgrades. Put the frontend behind HTTPS when exposing PaperJet beyond localhost and set `COOKIE_SECURE=true`.
The `db`, `pdf_storage`, and `thumbnails` volumes contain application data.
Back them up before maintenance or upgrades. Put the frontend behind HTTPS
when exposing PaperJet beyond localhost and set `COOKIE_SECURE=true`.
### Run a Forgejo-published image
Set `PAPERJET_IMAGE` in `.env` to the desired registry tag, for example the
`latest` or commit-SHA tag published by Forgejo. Then pull and start without
building locally:
```sh
docker compose pull
docker compose up -d --no-build
```
The published image exposes only port 80. Your outer reverse proxy should
target the Compose port configured by `HTTP_PORT`.
## Development
@ -39,6 +58,12 @@ The Vite server proxies `/api` to `http://localhost:8000`.
## Validation
```sh
# container
docker compose --env-file .env.example config --quiet
docker compose up --build -d
curl http://localhost:4982/api/v1/health
docker compose ps
# frontend
cd frontend
npm test -- --run
@ -53,4 +78,9 @@ mypy app/
ruff check .
```
The editor uses PDF.js for display and PyMuPDF for export. Stored annotation coordinates are PDF points with a top-left origin relative to the unrotated CropBox; this is the contract shared by the editor and export renderer.
Stop the local stack with `docker compose down`. Do not use `-v` unless you
intend to remove the local application volumes.
The editor uses PDF.js for display and PyMuPDF for export. Stored annotation
coordinates are PDF points with a top-left origin relative to the unrotated
CropBox; this is the contract shared by the editor and export renderer.