FROM node:latest

RUN apt-get update && \
    apt-get install -y git make doxygen python3-sphinx && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

RUN git clone --depth 1 https://git.jabber.space/devs/cproof.git ./cproof

COPY package*.json ./
RUN npm ci

COPY --exclude=.git . .
RUN cd /app/cproof/apidocs/c/ && ./gen.sh
RUN cd /app/cproof/apidocs/python/ && ls -alh && chmod +x gen.sh && ./gen.sh
RUN npm run astro telemetry disable
RUN npm run pre-build
RUN npm run build
