FROM debian:bookworm-slim

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
    && apt-get install -y \
        build-essential \
        debhelper \
        devscripts

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
        curl \
        ca-certificates \
        gnupg2 \
        libfontconfig \
    && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y --no-install-recommends \
        nodejs \
    && npm install -g npm

RUN rm -rf /var/lib/apt/lists/*

RUN groupadd -g 1000 jenkins \
    && useradd -d /home/jenkins -u 1000 -g 1000 -m -s /bin/bash jenkins \
    && mkdir -p /home/jenkins/agent/workspace \
    && chown -R jenkins:jenkins /home/jenkins/agent

USER jenkins
