# Labuh: one image for the Hub, the board and the reviewer (Codex app-server). The Hub and the
# board keep configuration and state on /data; the reviewer gets no GitLab token (compose.yaml).
FROM node:24-bookworm-slim
ARG TARGETARCH
ARG GLAB_VERSION=1.102.0
ARG CODEX_VERSION=0.167.0
RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates curl \
    && curl -fsSL -o /tmp/glab.deb "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_${TARGETARCH}.deb" \
    && apt-get install -y /tmp/glab.deb && rm /tmp/glab.deb \
    && apt-get purge -y curl && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* \
    && npm install -g --no-audit --no-fund @openai/codex@${CODEX_VERSION} && npm cache clean --force \
    && mkdir /data /codex && chown node /data /codex
WORKDIR /app
COPY package.json LICENSE ./
COPY src ./src
COPY board ./board
COPY rubric ./rubric
USER node
ENV LABUH_HOME=/data
VOLUME /data
EXPOSE 4810 4820
CMD ["node", "--disable-warning=ExperimentalWarning", "src/hub-cli.ts", "run"]
