FROM node:22-slim

# Install Chrome dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    chromium \
    fonts-freefont-ttf \
    fonts-noto-cjk \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY package.json package-lock.json ./
RUN npm ci --omit=dev

COPY md2html.js mermaid.min.js ./

ENV CHROME_PATH=/usr/bin/chromium

ENTRYPOINT ["node", "md2html.js"]
