# Multi-stage build for Heltec Wireless Tracker Documentation # Stage 1: Build the static site FROM node:22-slim AS builder # Disable telemetry ENV ASTRO_TELEMETRY_DISABLED=1 ENV CI=true WORKDIR /app # Copy package files COPY package.json package-lock.json ./ # Install dependencies RUN npm ci # Copy source files COPY . . # Build the static site RUN npm run build # Stage 2: Production server with nginx FROM nginx:alpine-slim AS production # Copy nginx config COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy built static files COPY --from=builder /app/dist /usr/share/nginx/html # Add healthcheck HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget -q --spider http://127.0.0.1:80/ || exit 1 EXPOSE 80 # Stage 3: Development server FROM node:22-slim AS development # Disable telemetry ENV ASTRO_TELEMETRY_DISABLED=1 WORKDIR /app # Copy package files COPY package.json package-lock.json ./ # Install dependencies RUN npm ci # Copy source files (will be overridden by volume mount in dev) COPY . . EXPOSE 4321 CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]