Files
ipx/Dockerfile.play
rays c0998f1ac7 Protobuf beside JSON in ipx's, the directory's and ipx-play's APIs (#465); ipx's build touches crates/play (#466)
A client sending Accept: application/x-protobuf gets protobuf, and one
sending Content-Type: application/x-protobuf may send its body so; JSON
stays the default, so the page, the TUI and older iOS builds see nothing
new. ipx's own calls to the directory and ipx-play now go in protobuf.

The handlers are untouched. A new crate, ipx-wire, holds the .proto
files (compiled by protox in build.rs, so no protoc anywhere) and one
layer, negotiate, that converts JSON at the edge through prost-reflect,
by a table of each route's messages. Writing prost structs beside every
serde one would have doubled each type and every handler.

Protobuf cannot tell absent from empty or from null, and the PATCH
bodies depend on that: an Option<Vec> left out leaves the list, an empty
one clears it, and null clears a folder. So a list in a body is a
one-field message (absent or present), and null-to-clear is a
google.protobuf.Value. Numbers in a Value come back whole, or 3.0 would
not read as a usize.

Debug builds convert every JSON answer strictly and answer 500 for a
field missing from the .proto or a route missing from a table; the cargo
tests and the browser suite (125 tests) ran clean that way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 22:23:06 +00:00

29 lines
1.5 KiB
Docker

# ipx-play (#447), the pages shared episodes open. Built from the repo's root:
# sh scripts/build-image.sh play
FROM rust:1-slim-trixie AS build
# SQLite is compiled from source for sqlx, which needs a C toolchain.
RUN apt-get update && apt-get install -y --no-install-recommends build-essential \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /src
# Every member of the workspace, since cargo reads them all to build one.
COPY Cargo.toml Cargo.lock ./
COPY crates ./crates
# The logo and icon its pages serve, compiled into the binary.
COPY web/logo.svg web/logo-dark.svg web/favicon.png ./web/
# Compiled crates kept in the builder between builds (#438), in a target of its own.
RUN --mount=type=cache,id=ipx-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \
--mount=type=cache,id=ipx-play-target,target=/src/target,sharing=locked \
touch crates/play/src/main.rs crates/play/src/lib.rs crates/directory/src/lib.rs crates/feed/src/lib.rs crates/wire/src/lib.rs crates/wire/proto/*.proto \
&& cargo build --release --locked -p ipx-play \
&& cp target/release/ipx-play /usr/local/bin/ipx-play
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=build /usr/local/bin/ipx-play /usr/local/bin/ipx-play
ENV PLAY_CONFIG=/config/play.toml
# Unraid's nobody:users. It writes nothing to disk: the database is elsewhere.
USER 99:100
EXPOSE 8102
CMD ["ipx-play"]