# Stage 1: build CSS bundle + precompile JSX (issue #139) FROM node:20-alpine AS build WORKDIR /build # Copy only the files needed to install deps (better cache layering) COPY package.json package-lock.json* ./ RUN npm install --no-audit --no-fund # Copy source CSS + tailwind config + every HTML/JSX file COPY tailwind.config.js postcss.config.js ./ COPY src/ ./src/ COPY public/ ./public/ COPY scripts/ ./scripts/ # Build CSS into public/dist/app.css RUN npx postcss ./src/css/app.css -o ./public/dist/app.css --env production # Precompile every .jsx → public/dist/*.js (no in-browser Babel at runtime) RUN node scripts/build-jsx.js # Stage 2: runtime FROM nginx:alpine COPY --from=build /build/public/ /usr/share/nginx/html/ COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80