# Stage 1: Build the Express.js app FROM node:24-alpine AS app-builder WORKDIR /app COPY package*.json ./ COPY app ./app RUN npm install RUN npm run build:app #-------------------- # Stage 2: Build the Docusaurus docs FROM node:24-alpine AS docs-builder WORKDIR /app/lstDocs COPY lstDocs/package*.json ./ COPY --from=app-builder /app/node_modules /app/node_modules COPY lstDocs ./ RUN npm install RUN npm run build #-------------------- # Stage 3: Build the Vite frontend FROM node:24-alpine AS front-builder WORKDIR /app/frontend COPY frontend/package*.json ./ COPY --from=app-builder /app/node_modules /app/node_modules COPY frontend ./ RUN npm install RUN npm run build #-------------------- # Stage 4: Create the final production image FROM node:24-alpine AS runner WORKDIR /app ENV NODE_ENV=production ENV RUNNING_IN_DOCKER=true # Copy production dependencies for the main app COPY package*.json ./ RUN npm install --omit=dev --ignore-scripts # Copy the built artifacts from each builder stage COPY --from=app-builder /app/dist ./dist COPY --from=docs-builder /app/lstDocs/build ./lstDocs/build COPY --from=front-builder /app/frontend/dist ./frontend/dist EXPOSE 4200 CMD ["node", "dist/main.js"]