Files
tern-server/Dockerfile
T
Mateusz PstruchaandClaude Opus 5.5 22c55854f3
CI / test (push) Successful in 4m39s
Add the tern.mtps.pl deployment, a registration gate and a healthcheck
deploy/tern.yml is the whole stack as one compose project for
ygg/actions/deploy (deploy/compose on kara): Postgres, the server at the
released version, ygg/static-server serving the matching tern-web
release, and an nginx proxy putting webapp and API (incl. /api/ws) on
one origin on port 11901, with sign-in rate-limited. Kara's nginx
fronts it as tern.mtps.pl. tern-web's release triggers the deploy.

Only the first user may now register unless OPEN_REGISTRATION=true,
so a public deployment isn't open sign-up; an advisory lock keeps two
racing first registrations from both succeeding.

`tern-server healthcheck` backs a Dockerfile HEALTHCHECK, so
`docker compose up --wait` waits for the server to serve — and fails a
deploy whose server can't start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:47:32 +02:00

18 lines
620 B
Docker

FROM rust:1-bookworm AS builder
WORKDIR /build
COPY Cargo.toml Cargo.lock* ./
COPY src ./src
COPY migrations ./migrations
RUN cargo build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /build/target/release/tern-server ./tern-server
COPY migrations ./migrations
EXPOSE 8080
# Healthy once the server answers /healthz (after migrations, on its port).
HEALTHCHECK --interval=5s --timeout=3s --start-period=30s --retries=5 \
CMD ["./tern-server", "healthcheck"]
CMD ["./tern-server"]