fabro/Dockerfile
Bryan Helmkamp 5335f8bcb4
feat(deploy): add Railway deploy path, honor $PORT in container
Teach the Dockerfile CMD to bind 0.0.0.0:${PORT:-32276} so PaaS providers
(Railway, Fly, Render, Cloud Run) route traffic without manual port
configuration. Default 32276 preserves local docker / docker-compose
behavior.

Ship railway.toml pointing Railway at the Dockerfile with on_failure
restarts. Replace the "coming soon" stub in docs/administration/deploy-
railway.mdx with a real guide: deploy button, Volume-at-/storage setup,
env vars, dev-token retrieval, and CLI pointing. Surface the Railway
deploy button in README.md under a new "Self-host the Fabro server"
section that also links to the other deploy guides.

Locally verified: PORT env override binds the chosen port, default
falls back to 32276, and tini signal propagation still gives clean
docker stop. End-to-end Railway verification still needs a live click-
through before the template URL is finalized.
2026-04-18 00:44:15 -04:00

44 lines
1.4 KiB
Docker

# syntax=docker/dockerfile:1.9
#
# Runtime image for the Fabro server.
#
# Binaries are supplied pre-built via the release workflow:
# docker-context/amd64/fabro (x86_64-unknown-linux-gnu)
# docker-context/arm64/fabro (aarch64-unknown-linux-gnu)
#
# The image serves the HTTP API (with embedded web UI) on $PORT (default
# 32276), persists state to /storage, and runs as the unprivileged `fabro`
# user. Honoring $PORT lets PaaS providers (Railway, Fly, Render, Heroku,
# Cloud Run) route traffic without extra configuration.
FROM debian:trixie-slim
ARG TARGETARCH
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
git \
tini \
&& rm -rf /var/lib/apt/lists/*
RUN groupadd --system --gid 1000 fabro \
&& useradd --system --uid 1000 --gid fabro \
--home-dir /var/fabro --shell /usr/sbin/nologin fabro \
&& install -d -o fabro -g fabro -m 0755 /var/fabro /storage \
&& install -d -m 0755 /etc/fabro
COPY --chmod=0755 docker-context/${TARGETARCH}/fabro /usr/local/bin/fabro
COPY docker/settings.toml /etc/fabro/settings.toml
COPY --chmod=0755 docker/entrypoint.sh /usr/local/bin/fabro-entrypoint
ENV FABRO_HOME=/var/fabro \
FABRO_CONFIG=/etc/fabro/settings.toml
VOLUME ["/storage"]
EXPOSE 32276
ENTRYPOINT ["/usr/bin/tini", "--", "/usr/local/bin/fabro-entrypoint"]
CMD ["sh", "-c", "exec fabro server start --foreground --bind 0.0.0.0:${PORT:-32276}"]