# Dockerfile for Bulma docs React customizer build
# Stage 1: build the React-based Bulma customizer
FROM node:22-alpine3.23 AS builder
# Install build tools for native modules
RUN apk add --no-cache python3 build-base
WORKDIR /workspace
# Install dependencies for the React customizer package
COPY docs/_react/bulma-customizer/package.json docs/_react/bulma-customizer/package.json
COPY docs/_react/bulma-customizer/package-lock.json docs/_react/bulma-customizer/package-lock.json
# Use npm ci for deterministic install when a lockfile exists
RUN cd docs/_react/bulma-customizer && npm ci
# Copy the rest of the package contents and build
COPY docs/_react/bulma-customizer/. docs/_react/bulma-customizer/.
RUN cd docs/_react/bulma-customizer && npm run build
# Stage 2: runtime image with a tiny static server
FROM node:22-alpine3.23
# Install curl for smoke tests (if available in test harness)
RUN apk add --no-cache curl
# Install a tiny static file server
RUN npm install -g http-server
WORKDIR /usr/share/bulma-customizer
# Health check endpoint
RUN echo 'OK' > healthz
# Copy built assets from the builder (this should include index.html if produced by the build)
COPY --from=builder /workspace/docs/assets/javascript/bulma-customizer /usr/share/bulma-customizer
# Expose port for the static server
EXPOSE 8080
CMD ["http-server", ".", "-p", "8080"]