Containerize the server: multi-stage build, compose, data volume

The runtime image carries only what serving needs — the Julia runtime, an
already-precompiled depot, exiftool, and optionally github-linguist. The
package registry, git clones, and the Ruby/C toolchain that builds rugged
all stay in earlier stages.

Two things shape the build. Dependencies are instantiated and precompiled in
a layer keyed only on Project.toml/Manifest.toml, so a src/ edit rebuilds in
seconds rather than minutes; a stub src/FileServer.jl satisfies Pkg's
root-package check there. And github-linguist, the one heavy optional
dependency, is behind WITH_LINGUIST: it degrades gracefully (stage 4 keeps
natural-language enrichment and warns), so building it out is a supported
~160MB saving.

All stage directories are pointed under /data via the FS_*_DIR variables so
one volume holds the whole in-flight working set, and data/ is excluded from
the build context.

Claude-Session: https://claude.ai/code/session_01KMNwyqLS3ns6uwWHGDGdAQ
This commit is contained in:
2026-08-07 15:38:33 -04:00
parent 4a22123001
commit 819a4cce7a
3 changed files with 189 additions and 0 deletions

27
docker-compose.yml Normal file
View File

@@ -0,0 +1,27 @@
services:
file-server:
build:
context: .
args:
# false drops the Ruby toolchain and github-linguist (~160MB smaller).
# Stage-4 text files then get natural-language enrichment but no
# programming language — the server warns at startup and carries on.
WITH_LINGUIST: "true"
image: file-server:latest
ports:
- "8080:8080"
volumes:
# Every pipeline stage (spool, done, text_done, binary, failed, nominated)
# lives under /data, so one volume holds the whole in-flight working set.
- fs-data:/data
environment:
# The four pools each default to nthreads(), which oversubscribes the
# threads Julia actually has. Size them for the host instead.
FS_WORKERS: "4"
FS_KNOWN_WORKERS: "4"
FS_UNKNOWN_WORKERS: "2"
FS_TEXT_WORKERS: "2"
restart: unless-stopped
volumes:
fs-data: