mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 13:39:41 +02:00
- Add Dockerfile for multi-stage Docker build - Add mana-core-auth integration with login/register pages - Add auth store using Svelte 5 runes - Add protected route layout with auth guard - Add health endpoint for container health checks - Add runtime URL injection via hooks.server.ts - Add logout button to header - Update docker-compose.macmini.yml with llm-playground service - Update cloudflared-config.yml with playground.mana.how route - Update mana-llm CORS config for playground domain - Update generate-env.mjs with auth URL variable Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
69 lines
1.9 KiB
Docker
69 lines
1.9 KiB
Docker
# Build stage
|
|
FROM node:20-alpine AS builder
|
|
|
|
# Build arguments for SvelteKit static env vars
|
|
ARG PUBLIC_MANA_CORE_AUTH_URL=http://mana-core-auth:3001
|
|
ARG PUBLIC_MANA_LLM_URL=http://mana-llm:3025
|
|
|
|
# Set as environment variables for build
|
|
ENV PUBLIC_MANA_CORE_AUTH_URL=$PUBLIC_MANA_CORE_AUTH_URL
|
|
ENV PUBLIC_MANA_LLM_URL=$PUBLIC_MANA_LLM_URL
|
|
|
|
# Install pnpm
|
|
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy root workspace files
|
|
COPY pnpm-workspace.yaml ./
|
|
COPY package.json ./
|
|
COPY pnpm-lock.yaml ./
|
|
|
|
# Copy shared packages needed by llm-playground
|
|
COPY packages/shared-auth ./packages/shared-auth
|
|
|
|
# Copy llm-playground service
|
|
COPY services/llm-playground ./services/llm-playground
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Build shared packages that need building
|
|
WORKDIR /app/packages/shared-auth
|
|
RUN pnpm build || true
|
|
|
|
# Build the web app
|
|
WORKDIR /app/services/llm-playground
|
|
RUN pnpm exec svelte-kit sync
|
|
RUN pnpm build
|
|
|
|
# Production stage
|
|
FROM node:20-alpine AS production
|
|
|
|
# Keep same directory structure as builder so pnpm symlinks resolve correctly
|
|
WORKDIR /app/services/llm-playground
|
|
|
|
# Copy the pnpm store that symlinks point to (at /app/node_modules/.pnpm)
|
|
COPY --from=builder /app/node_modules/.pnpm /app/node_modules/.pnpm
|
|
|
|
# Copy the app's node_modules (contains symlinks to the pnpm store)
|
|
COPY --from=builder /app/services/llm-playground/node_modules ./node_modules
|
|
|
|
# Copy built application
|
|
COPY --from=builder /app/services/llm-playground/build ./build
|
|
COPY --from=builder /app/services/llm-playground/package.json ./
|
|
|
|
# Expose port
|
|
EXPOSE 5190
|
|
|
|
# Set environment variables
|
|
ENV NODE_ENV=production
|
|
ENV PORT=5190
|
|
ENV HOST=0.0.0.0
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:5190/health || exit 1
|
|
|
|
# Run the app
|
|
CMD ["node", "build"]
|