- Add PostgreSQL database schema (users, subscriptions, tenants, sessions) - Implement authentication service with Argon2id password hashing - Add JWT-based session management with access/refresh tokens - Create REST API routes (auth, agent, usage, billing) - Add encryption utilities (AES-256-GCM) and Vault integration - Set up Docker Compose development environment - Add Hono-based API server with middleware This establishes the foundation for transforming moltbot into a multi-tenant SaaS platform with secure authentication and per-tenant encryption. https://claude.ai/code/session_01UzVUSnxfEecZE8Yes3Zqw9
57 lines
1.1 KiB
Docker
57 lines
1.1 KiB
Docker
# Build stage
|
|
FROM node:22-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Install pnpm
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
|
|
# Copy package files
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
# Install dependencies
|
|
RUN pnpm install --frozen-lockfile || pnpm install
|
|
|
|
# Copy source code
|
|
COPY tsconfig.json ./
|
|
COPY src ./src
|
|
|
|
# Build TypeScript
|
|
RUN pnpm build
|
|
|
|
# Production stage
|
|
FROM node:22-alpine AS production
|
|
|
|
WORKDIR /app
|
|
|
|
# Install pnpm
|
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
|
|
# Copy package files
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
|
|
# Install production dependencies only
|
|
RUN pnpm install --prod --frozen-lockfile || pnpm install --prod
|
|
|
|
# Copy built files from builder
|
|
COPY --from=builder /app/dist ./dist
|
|
|
|
# Create non-root user
|
|
RUN addgroup -g 1001 -S moltbot && \
|
|
adduser -S moltbot -u 1001 -G moltbot
|
|
|
|
USER moltbot
|
|
|
|
# Environment defaults
|
|
ENV NODE_ENV=production
|
|
ENV PORT=3000
|
|
ENV HOST=0.0.0.0
|
|
|
|
EXPOSE 3000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
|
|
|
|
CMD ["node", "dist/server.js"]
|