mirror of
https://github.com/truespar/sentio.git
synced 2026-11-17 16:17:37 +00:00
The quickstart told people to run `up -d --build`, which is a release build of thirteen crates before they can see anything work. That is a poor first impression for software whose whole pitch is that it is easy to run. `docker compose up -d` now pulls ghcr.io/truespar/sentio. Each architecture is built on its own native runner - amd64 on ubuntu-latest, arm64 on ubuntu-24.04-arm - and the two are merged into one manifest afterwards. The obvious alternative, one buildx job with both platforms, cross-builds arm64 under QEMU, and a Rust release build under emulation runs for well over an hour. arm64 matters here because most people trying this on a laptop are on Apple silicon. Tags: latest on main, sha-<short> always, and semver on v* tags so a deployment can pin. GHCR needs no credentials beyond GITHUB_TOKEN. docker-compose.build.yml keeps the from-source path for anyone changing the code, and the image name is unchanged between the two so nothing else in the stack cares which produced it. CI's docker job now runs on pull requests only, since main is covered here. Verified locally through the build overlay: image builds, stack comes up, e2e passes 9/9.
63 lines
2.4 KiB
Docker
63 lines
2.4 KiB
Docker
# syntax=docker/dockerfile:1.7
|
|
|
|
# ── Builder ──────────────────────────────────────────────────────────────
|
|
FROM rust:1-bookworm AS builder
|
|
|
|
WORKDIR /build
|
|
|
|
# aws-lc-rs (rustls backend) needs cmake + a C toolchain; build-essential is
|
|
# already present in the rust: image. libclang is only needed by some crates
|
|
# in the tree - install here rather than debugging a rebuild later.
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
cmake \
|
|
libclang-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY . .
|
|
|
|
# Use the committed .sqlx/ offline cache so the build doesn't need a live DB.
|
|
ENV SQLX_OFFLINE=true
|
|
|
|
RUN cargo build --release --bin sentio-smtp \
|
|
&& strip target/release/sentio-smtp
|
|
|
|
# ── Runtime ──────────────────────────────────────────────────────────────
|
|
FROM debian:bookworm-slim AS runtime
|
|
|
|
LABEL org.opencontainers.image.title="Sentio SMTP" \
|
|
org.opencontainers.image.description="Email inbox API for AI agents: a multi-tenant mail server in Rust" \
|
|
org.opencontainers.image.source="https://github.com/truespar/sentio" \
|
|
org.opencontainers.image.licenses="Apache-2.0"
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
curl \
|
|
libcap2-bin \
|
|
tzdata \
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
&& groupadd --system --gid 1000 sentio \
|
|
&& useradd --system --uid 1000 --gid sentio \
|
|
--home-dir /var/lib/sentio --shell /usr/sbin/nologin sentio \
|
|
&& mkdir -p /etc/sentio /var/lib/sentio \
|
|
&& chown -R sentio:sentio /etc/sentio /var/lib/sentio
|
|
|
|
COPY --from=builder /build/target/release/sentio-smtp /usr/local/bin/sentio-smtp
|
|
COPY --from=builder /build/migrations /usr/share/sentio/migrations
|
|
COPY config/oss.toml /etc/sentio/oss.toml
|
|
|
|
# Allow the non-root user to bind :25/465/587 without full root.
|
|
RUN setcap 'cap_net_bind_service=+ep' /usr/local/bin/sentio-smtp
|
|
|
|
USER sentio
|
|
WORKDIR /var/lib/sentio
|
|
|
|
EXPOSE 25 465 587 8080 9090
|
|
|
|
HEALTHCHECK --interval=10s --timeout=5s --start-period=30s --retries=6 \
|
|
CMD curl -fsS http://localhost:8080/health/ready || exit 1
|
|
|
|
ENTRYPOINT ["/usr/local/bin/sentio-smtp"]
|
|
CMD ["--config", "/etc/sentio/oss.toml", "serve"]
|