Add a compile-time i18n system with 270 translation keys across 5 locales (EN, DE, FR, ES, PT). Translations are embedded via include_str! and parsed lazily into flat HashMaps with English fallback for missing keys. - Add src/i18n module with Locale enum, t()/tw() lookup functions, and tests - Add JSON translation files for all 5 locales under assets/i18n/ - Provide locale Signal via Dioxus context in App, persisted to localStorage - Replace all hardcoded UI strings across 33 component/page files - Add compact locale picker (globe icon + ISO alpha-2 code) in sidebar header - Add click-outside backdrop dismissal for locale dropdown Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Sharang Parnerkar <parnerkarsharang@gmail.com> Reviewed-on: #12
70 lines
2.0 KiB
Docker
70 lines
2.0 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# Stage 1: Generate dependency recipe for caching
|
|
FROM rust:1.89-bookworm AS chef
|
|
RUN cargo install cargo-chef
|
|
WORKDIR /app
|
|
|
|
FROM chef AS planner
|
|
COPY . .
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
# Stage 2: Build dependencies + application
|
|
FROM chef AS builder
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
pkg-config libssl-dev curl unzip \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install sccache for compile caching across Docker builds
|
|
RUN curl -fsSL https://github.com/mozilla/sccache/releases/download/v0.9.1/sccache-v0.9.1-x86_64-unknown-linux-musl.tar.gz \
|
|
| tar xz --strip-components=1 -C /usr/local/bin/ sccache-v0.9.1-x86_64-unknown-linux-musl/sccache \
|
|
&& chmod +x /usr/local/bin/sccache
|
|
|
|
ENV RUSTC_WRAPPER=/usr/local/bin/sccache
|
|
ENV SCCACHE_DIR=/tmp/sccache
|
|
|
|
# Install bun (for Tailwind CSS build step)
|
|
RUN curl -fsSL https://bun.sh/install | bash
|
|
ENV PATH="/root/.bun/bin:$PATH"
|
|
|
|
# Install dx CLI from source (binstall binaries require GLIBC >= 2.38)
|
|
RUN --mount=type=cache,target=/tmp/sccache \
|
|
cargo install dioxus-cli@0.7.3 --locked
|
|
|
|
# Cook dependencies from recipe (cached layer)
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
RUN --mount=type=cache,target=/tmp/sccache \
|
|
cargo chef cook --release --recipe-path recipe.json
|
|
|
|
# Copy source and build
|
|
COPY . .
|
|
|
|
# Install frontend dependencies (DaisyUI, Tailwind) for the build.rs CSS step
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Bundle the fullstack application
|
|
RUN --mount=type=cache,target=/tmp/sccache \
|
|
dx bundle --release --fullstack
|
|
|
|
# Stage 3: Minimal runtime image
|
|
FROM debian:bookworm-slim AS runtime
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates libssl3 \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
RUN useradd --create-home --shell /bin/bash app
|
|
USER app
|
|
WORKDIR /home/app
|
|
|
|
# Copy the bundled output from builder
|
|
COPY --from=builder --chown=app:app /app/target/dx/dashboard/release/web/ ./
|
|
|
|
EXPOSE 8000
|
|
|
|
ENV IP=0.0.0.0
|
|
ENV PORT=8000
|
|
|
|
ENTRYPOINT ["./dashboard"]
|