Phase 1 - Virtual Scrolling: - Add @tanstack/react-virtual for efficient message list rendering - Only render visible messages instead of entire history - Fix auto-scroll using native scrollTop instead of unreliable virtualizer Phase 2 - Context Optimization: - Split monolithic SessionContext into 4 specialized contexts - MessagesContext, SessionsContext, SettingsContext, UIContext - Prevents unnecessary re-renders across unrelated components Phase 3 - Compression & Cleanup: - Enable Brotli compression (~23% smaller than gzip) - Switch to fholzer/nginx-brotli:v1.28.0 image - Add automatic upload cleanup for idle sessions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
799 B
Docker
41 lines
799 B
Docker
# syntax=docker/dockerfile:1.4
|
|
# Build stage
|
|
FROM node:20-slim AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Build args for environment variables
|
|
ARG VITE_WS_URL
|
|
ARG VITE_API_URL
|
|
|
|
# Set as environment variables for build
|
|
ENV VITE_WS_URL=$VITE_WS_URL
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
|
|
# Copy package files
|
|
COPY package*.json ./
|
|
|
|
# Install dependencies with cache mount
|
|
RUN --mount=type=cache,target=/root/.npm \
|
|
npm install
|
|
|
|
# Copy source
|
|
COPY . .
|
|
|
|
# Build the app
|
|
RUN npm run build
|
|
|
|
# Production stage - using nginx with brotli support
|
|
FROM fholzer/nginx-brotli:v1.28.0
|
|
|
|
# Copy built files
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
|
|
# Copy nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
# fholzer/nginx-brotli has ENTRYPOINT ["nginx"], so only pass args
|
|
CMD ["-g", "daemon off;"]
|