mirror of
https://github.com/Xevion/xevion.dev.git
synced 2026-01-31 04:26:43 -06:00
feat: add multi-encoding compression with lazy caching and pre-compressed assets
- Build-time: pre-compress static assets (.gz, .br, .zst) via compress-assets.ts - Runtime: serve pre-compressed embedded assets with Accept-Encoding negotiation - ISR cache: lazy per-encoding compression (compress on first request, cache result) - tower-http: enable runtime compression for API/SSR responses (respects Content-Encoding)
This commit is contained in:
@@ -34,6 +34,9 @@ RUN cargo build --release
|
||||
FROM oven/bun:1 AS frontend
|
||||
WORKDIR /build
|
||||
|
||||
# Install system zstd for pre-compression
|
||||
RUN apt-get update && apt-get install -y zstd && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install dependencies (cached until package.json/bun.lock change)
|
||||
COPY web/package.json web/bun.lock ./
|
||||
RUN bun install --frozen-lockfile
|
||||
@@ -43,6 +46,9 @@ COPY web/ ./
|
||||
ARG VITE_OG_R2_BASE_URL
|
||||
RUN bun run build
|
||||
|
||||
# Pre-compress static assets (gzip, brotli, zstd)
|
||||
RUN bun run scripts/compress-assets.ts
|
||||
|
||||
# ========== Stage 5: Final Rust Build (with embedded assets) ==========
|
||||
FROM chef AS final-builder
|
||||
|
||||
|
||||
Reference in New Issue
Block a user