FROM python:3.11-slim

# avoid prompts from apt
ENV DEBIAN_FRONTEND=noninteractive

# Install Git and build tools
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        git \
        build-essential && \
    rm -rf /var/lib/apt/lists/*

# Install pip build/upload tools and ensure modern packaging stack
RUN pip install --no-cache-dir \
      --upgrade pip \
      "setuptools>=61.0.0" \
      "packaging>=20.0" \
      "wheel>=0.45.0" \
      "setuptools-scm[toml]>=6.0" \
      build==1.2.2.post1 \
      twine==6.1.0

# user operations
# - create a dedicated jenkins user with a home directory
# - switch to that user going forward
# - ensure HOME is set and we land there
RUN useradd -m -d /home/jenkins jenkins

USER jenkins

ENV HOME=/home/jenkins
WORKDIR /home/jenkins
