Replaces the slice-2 hardcoded installation with a full install/deploy pipeline: - SQLite persistence (better-sqlite3) with a single `installations` table and a draft -> cloning -> building -> built -> starting -> running/error/stopped state machine; env vars and bearer tokens are encrypted at rest (AES-256-GCM, key derived from MASTER_KEY). - Build/run orchestration: git clone (+ .env.example key detection), `nixpacks build` as a logged subprocess, dockerode container run/stop with forced host/port env vars and a TCP-connect health check before flipping an installation to "running". - REST API (installations CRUD, build/deploy/redeploy, logs, token regeneration) behind single-operator session-cookie auth with a basic login lockout. - Vite+React admin SPA: login, installation list, install wizard, and a detail page to configure env vars, trigger build/deploy/redeploy, view the build log, and copy the authenticated /mcp/<slug> URL. - Dockerfile (multi-stage, pulls in nixpacks + the Docker CLI) and docker-compose.yml for production deployment. Validated end-to-end against a real cloned repo: draft creation with env-key detection, build, the error path on a failed health check, and delete, all through the live API. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
33 lines
1.0 KiB
Docker
33 lines
1.0 KiB
Docker
FROM ghcr.io/railwayapp/nixpacks:1.41.0 AS nixpacks
|
|
FROM docker:27-cli AS dockercli
|
|
|
|
FROM node:20-slim AS build
|
|
WORKDIR /repo
|
|
COPY package.json package-lock.json ./
|
|
COPY apps/server/package.json apps/server/package.json
|
|
COPY apps/web/package.json apps/web/package.json
|
|
RUN npm ci
|
|
COPY apps/server apps/server
|
|
COPY apps/web apps/web
|
|
RUN npm run build --workspace apps/web
|
|
RUN npm run build --workspace apps/server
|
|
|
|
FROM node:20-slim
|
|
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
COPY --from=nixpacks /usr/bin/nixpacks /usr/local/bin/nixpacks
|
|
COPY --from=dockercli /usr/local/bin/docker /usr/local/bin/docker
|
|
|
|
WORKDIR /repo
|
|
COPY package.json package-lock.json ./
|
|
COPY apps/server/package.json apps/server/package.json
|
|
RUN npm ci --omit=dev --workspace apps/server
|
|
|
|
COPY --from=build /repo/apps/server/dist apps/server/dist
|
|
COPY --from=build /repo/apps/web/dist apps/web/dist
|
|
|
|
WORKDIR /repo/apps/server
|
|
ENV NODE_ENV=production
|
|
EXPOSE 3000
|
|
CMD ["node", "dist/index.js"]
|