455817204f
The registry service keeps players' ratings of published projects in one
SQLite file on a volume (REGISTRY_DB, /data on Railway):
- GET /api/mods/ratings: every rated project's average and count, cached a
minute; never who rated.
- GET /api/mods/{id}/rating: the signed-in account's own rating.
- POST /api/mods/{id}/rating: sets or changes it, checked like a submission
(origin, session, CSRF token), 30 per account and 600 in all per hour, only
for projects on the registry's main, never by their owners.
- The sign-in takes ?back=/mods/<id> to come back to a project's page.
The image hands the volume to nobody before running as nobody.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
1.1 KiB
Docker
19 lines
1.1 KiB
Docker
# Built from the repository root: docker build -f crates/horizon-mod-registry/Dockerfile .
|
|
FROM rust:1-slim AS build
|
|
WORKDIR /src
|
|
# The root manifest only for the shared crate's workspace settings (edition, lints).
|
|
COPY Cargo.toml Cargo.toml
|
|
COPY crates/horizon-mods crates/horizon-mods
|
|
# horizon-mods' optional dependency: cargo needs its manifest even with the feature off.
|
|
COPY crates/horizon-shader-api crates/horizon-shader-api
|
|
COPY crates/horizon-mod-registry crates/horizon-mod-registry
|
|
RUN cargo build --release --locked --manifest-path crates/horizon-mod-registry/Cargo.toml
|
|
|
|
FROM debian:stable-slim
|
|
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
|
|
COPY --from=build /src/crates/horizon-mod-registry/target/release/horizon-mod-registry /usr/local/bin/
|
|
ENV REGISTRY_DB=/data/registry.sqlite3
|
|
# Railway mounts the ratings' volume at /data owned by root: hand it to nobody, then run as nobody (setpriv is
|
|
# util-linux's, in every Debian image).
|
|
CMD ["sh", "-c", "mkdir -p /data && chown nobody:nogroup /data && exec setpriv --reuid=nobody --regid=nogroup --clear-groups horizon-mod-registry"]
|