# Slate documentation builder
# Used by CI to generate static HTML from OpenAPI specs

FROM ruby:3.2-slim

# Install build dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    nodejs \
    npm \
    git \
    && rm -rf /var/lib/apt/lists/*

# Install widdershins globally for OpenAPI to Slate markdown conversion
RUN npm install -g widdershins

WORKDIR /docs

# Copy Gemfile first for layer caching
COPY Gemfile Gemfile.lock* ./
RUN bundle install

# Copy the rest of the docs source
COPY . .

# Build static site
CMD ["bundle", "exec", "middleman", "build", "--clean"]
