Phase 1 implementation with ngspice backend and Astro/React frontend: Backend (FastAPI): - ngspice subprocess engine with custom .raw file parser - Notebook CRUD with .spicebook JSON format (filesystem storage) - Simulation endpoints (standalone + cell-in-notebook) - SVG waveform export endpoint - 18 REST API routes, 5 passing tests Frontend (Astro 5 + React 19): - Notebook editor as React island with Zustand state management - CodeMirror 6 with custom SPICE language mode (syntax highlighting for dot commands, components, engineering notation, comments) - uPlot waveform viewer with transient and AC/Bode plot modes - Markdown cells with edit/preview toggle - Notebook list with card grid UI - Dark theme, Tailwind CSS 4, Lucide icons Infrastructure: - Docker Compose with dev/prod targets - Caddy-based frontend prod serving - 3 example notebooks (RC filter, voltage divider, CE amplifier)
49 lines
1.3 KiB
Docker
49 lines
1.3 KiB
Docker
# ── Dev stage ────────────────────────────────────────────────────────
|
|
FROM node:20-slim AS dev
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm install
|
|
|
|
COPY . .
|
|
|
|
EXPOSE 4321
|
|
|
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
|
|
|
|
|
# ── Build stage ──────────────────────────────────────────────────────
|
|
FROM node:20-slim AS build
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json* ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
|
|
# ── Prod stage ───────────────────────────────────────────────────────
|
|
FROM caddy:2-alpine AS prod
|
|
|
|
COPY --from=build /app/dist /srv
|
|
|
|
# Simple Caddyfile for serving the static Astro build
|
|
RUN echo ':4321 {\n\
|
|
root * /srv\n\
|
|
encode gzip\n\
|
|
try_files {path} {path}/index.html /index.html\n\
|
|
file_server\n\
|
|
header {\n\
|
|
X-Content-Type-Options nosniff\n\
|
|
X-Frame-Options DENY\n\
|
|
Referrer-Policy strict-origin-when-cross-origin\n\
|
|
}\n\
|
|
}' > /etc/caddy/Caddyfile
|
|
|
|
EXPOSE 4321
|
|
|
|
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
|