mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-06 21:54:01 -05:00
* Adding guardrails block * ack PR comments * cleanup checkbox in dark mode * cleanup * fix supabase tools
84 lines
2.5 KiB
Docker
84 lines
2.5 KiB
Docker
# ========================================
|
|
# Base Stage: Alpine Linux with Bun
|
|
# ========================================
|
|
FROM oven/bun:1.2.22-alpine AS base
|
|
|
|
# ========================================
|
|
# Dependencies Stage: Install Dependencies
|
|
# ========================================
|
|
FROM base AS deps
|
|
RUN apk add --no-cache libc6-compat
|
|
WORKDIR /app
|
|
|
|
# Install turbo globally
|
|
RUN bun install -g turbo
|
|
|
|
COPY package.json bun.lock ./
|
|
RUN mkdir -p apps
|
|
COPY apps/sim/package.json ./apps/sim/package.json
|
|
|
|
RUN bun install --omit dev --ignore-scripts
|
|
|
|
# ========================================
|
|
# Builder Stage: Build the Application
|
|
# ========================================
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
|
|
# Install turbo globally in builder stage
|
|
RUN bun install -g turbo
|
|
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
|
|
# Installing with full context to prevent missing dependencies error
|
|
RUN bun install --omit dev --ignore-scripts
|
|
|
|
# Required for standalone nextjs build
|
|
WORKDIR /app/apps/sim
|
|
RUN bun install sharp
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED=1 \
|
|
VERCEL_TELEMETRY_DISABLED=1 \
|
|
DOCKER_BUILD=1
|
|
|
|
WORKDIR /app
|
|
|
|
# Provide dummy database URLs during image build so server code that imports @sim/db
|
|
# can be evaluated without crashing. Runtime environments should override these.
|
|
ARG DATABASE_URL="postgresql://user:pass@localhost:5432/dummy"
|
|
ENV DATABASE_URL=${DATABASE_URL}
|
|
|
|
RUN bun run build
|
|
|
|
# ========================================
|
|
# Runner Stage: Run the actual app
|
|
# ========================================
|
|
|
|
FROM base AS runner
|
|
WORKDIR /app
|
|
|
|
# Install Python and dependencies for guardrails PII detection
|
|
RUN apk add --no-cache python3 py3-pip bash
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
COPY --from=builder /app/apps/sim/public ./apps/sim/public
|
|
COPY --from=builder /app/apps/sim/.next/standalone ./
|
|
COPY --from=builder /app/apps/sim/.next/static ./apps/sim/.next/static
|
|
|
|
# Copy guardrails setup script and requirements
|
|
COPY --from=builder /app/apps/sim/lib/guardrails/setup.sh ./apps/sim/lib/guardrails/setup.sh
|
|
COPY --from=builder /app/apps/sim/lib/guardrails/requirements.txt ./apps/sim/lib/guardrails/requirements.txt
|
|
COPY --from=builder /app/apps/sim/lib/guardrails/validate_pii.py ./apps/sim/lib/guardrails/validate_pii.py
|
|
|
|
# Run guardrails setup to create venv and install Python dependencies
|
|
RUN chmod +x ./apps/sim/lib/guardrails/setup.sh && \
|
|
cd ./apps/sim/lib/guardrails && \
|
|
./setup.sh
|
|
|
|
EXPOSE 3000
|
|
ENV PORT=3000 \
|
|
HOSTNAME="0.0.0.0"
|
|
|
|
CMD ["bun", "apps/sim/server.js"] |