FROM python:3.11-slim

ENV DEBIAN_FRONTEND=noninteractive \
    LANG=en_US.UTF-8 \
    LC_ALL=en_US.UTF-8

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        bash \
        curl \
        wget \
        ca-certificates \
        git \
        build-essential \
        openssh-client \
        expect \
        zip \
        unzip \
        locales \
        tzdata \
        iputils-ping && \
    sed -i 's/# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen && \
    locale-gen && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /opt/workspace

COPY docker/toolbox-requirements.txt /tmp/toolbox-requirements.txt

RUN python -m venv /opt/agent-venv && \
    /opt/agent-venv/bin/pip install --no-cache-dir --upgrade pip && \
    /opt/agent-venv/bin/pip install --no-cache-dir -r /tmp/toolbox-requirements.txt && \
    rm -f /tmp/toolbox-requirements.txt

ENV AGENT_TOOLBOX_VENV=/opt/agent-venv
ENV PATH="/opt/agent-venv/bin:${PATH}"
