- worker: sends email_outbox mail over SMTP (lettre), woken by LISTEN/NOTIFY, SKIP LOCKED claiming, retries with backoff, hu/en templates (text + HTML), hourly cleanup of expired data - migration 0002: next_attempt_at, failed_at, notify trigger - docker-compose.override.yml: Mailpit for development only - Dockerfiles: lock shared cargo cache mounts for parallel builds Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
31 lines
989 B
Docker
31 lines
989 B
Docker
# syntax=docker/dockerfile:1
|
|
#
|
|
# Build from the repository root:
|
|
# docker build -f services/backend/Dockerfile -t sorsfonalak/backend .
|
|
|
|
ARG RUST_VERSION=1.99
|
|
|
|
# --- 1. static (musl) build ----------------------------------------------------
|
|
FROM rust:${RUST_VERSION}-alpine AS build
|
|
RUN apk add --no-cache musl-dev
|
|
WORKDIR /app
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY crates crates
|
|
COPY services services
|
|
RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \
|
|
--mount=type=cache,target=/app/target,sharing=locked \
|
|
cargo build --release --locked -p backend \
|
|
&& cp target/release/backend /backend
|
|
|
|
# --- 2. runtime: the binary only (TLS roots are compiled in via webpki-roots) ---
|
|
FROM scratch
|
|
COPY --from=build /backend /backend
|
|
ENV BIND_ADDR=0.0.0.0:8081 \
|
|
LOG_FORMAT=json \
|
|
RUST_LOG=info
|
|
USER 65532:65532
|
|
EXPOSE 8081
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \
|
|
CMD ["/backend", "healthcheck"]
|
|
ENTRYPOINT ["/backend"]
|