fix: streamline Docker build process and update build scripts

pull/10/head
David Montero Crespo 2026-03-06 13:17:14 -03:00
parent 2a8d126b2b
commit 862d90c2b7
2 changed files with 4 additions and 6 deletions

View File

@ -3,10 +3,6 @@ FROM node:20 AS frontend-builder
WORKDIR /app
# Copy root package.json (metadata/scripts)
COPY package.json .
RUN npm install
# Build avr8js
COPY wokwi-libs/avr8js/ wokwi-libs/avr8js/
WORKDIR /app/wokwi-libs/avr8js
@ -23,11 +19,12 @@ WORKDIR /app/wokwi-libs/wokwi-elements
RUN npm install && npm run build --if-present
# Build frontend
# components-metadata.json is already committed; skip generate:metadata
# (it requires wokwi-elements/src which isn't needed at runtime)
WORKDIR /app
COPY frontend/ frontend/
COPY scripts/ scripts/
WORKDIR /app/frontend
RUN npm install && npm run build
RUN npm install && npm run build:docker
# ---- Stage 2: Final Production Image ----

View File

@ -7,6 +7,7 @@
"generate:metadata": "cd .. && npx tsx scripts/generate-component-metadata.ts",
"dev": "npm run generate:metadata && vite",
"build": "npm run generate:metadata && tsc -b && vite build",
"build:docker": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview",
"test": "vitest run",