FROM eclipse-temurin:21-jdk-jammy

# Install Node.js 22 and basic tools
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      curl \
      ca-certificates \
      gnupg2 \
      software-properties-common && \
    curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
    apt-get install -y --no-install-recommends nodejs && \
    # Add SWI-Prolog PPA and install everything else
    apt-add-repository -y ppa:swi-prolog/stable && \
    apt-get update && apt-get install -y --no-install-recommends \
    swi-prolog \
    xvfb \
    libglib2.0-0 \
    libnss3 \
    libxkbfile1 \
    libxss1 \
    libxshmfence1 \
    libasound2 \
    libgbm1 \
    libx11-xcb1 \
    libxrandr2 \
    libxdamage1 \
    libxcomposite1 \
    libxtst6 \
    libxfixes3 \
    libcups2 \
    libatk-bridge2.0-0 \
    libatspi2.0-0 \
    libgtk-3-0 \
    fonts-liberation && \
    rm -rf /var/lib/apt/lists/*

# Verify environment
RUN node --version && npm --version && swipl --version

WORKDIR /workspace

# No COPY . . here! The GitLab Runner handles the code injection.