FROM registry.access.redhat.com/ubi9/python-311:latest

LABEL org.opencontainers.image.source=https://github.com/redhat-cop/ansible.mcp_builder
LABEL org.opencontainers.image.authors="Ansible Content Team"
LABEL org.opencontainers.image.vendor="Red Hat"
LABEL org.opencontainers.image.licenses="GPL-3.0"
LABEL org.opencontainers.image.description="Test base image for ansible.mcp_builder collection"

ENV CI=1
ENV DEBIAN_FRONTEND=noninteractive
ENV GOPATH=/go
ENV GOCACHE=/tmp/go-cache
ENV PATH=/root/.local/bin:/usr/local/go/bin:${GOPATH}/bin:${PATH}

USER root
WORKDIR /workspace

COPY bindep.txt /workspace/bindep.txt

RUN dnf install -y --allowerasing python3 python3-pip && dnf clean all

RUN pip3 install --no-cache-dir bindep

RUN dnf install -y --allowerasing \
    python3-devel \
    make \
    wget \
    curl \
    podman \
    $(bindep -b /workspace/bindep.txt -f /workspace/bindep.txt 2>/dev/null | grep -v "^#" | tr '\n' ' ') \
    && dnf clean all

RUN pip3 install --no-cache-dir --upgrade pip && \
    pip3 install --no-cache-dir \
    ansible-core>=2.17 \
    molecule \
    molecule-plugins[podman] \
    pytest \
    pytest-ansible

RUN mkdir -p /opt/mcp /workspace /go /tmp/go-cache

RUN ansible --version && \
    python3 --version

CMD ["/bin/bash"]
