FROM quay.io/devfile/base-developer-image:ubi9-latest

ARG PYV=3.12
ARG ENABLE_NOPASSWD_SUDO=true

LABEL org.opencontainers.image.source=https://github.com/ansible/ansible-dev-tools
LABEL org.opencontainers.image.authors="Ansible DevTools"
LABEL org.opencontainers.image.vendor="Red Hat"
LABEL org.opencontainers.image.licenses="GPL-3.0"
LABEL org.opencontainers.image.description="An OpenShift Dev Spaces container image for Ansible."

USER 0

WORKDIR /context
RUN --mount=type=bind,target=. --mount=type=cache,dst=/var/cache/dnf --mount=type=cache,dst=/root/.cache/pip ENABLE_NOPASSWD_SUDO="${ENABLE_NOPASSWD_SUDO}" ./setup.sh

ENV BUILDAH_ISOLATION=chroot

# Reflect the UID that the SCC will force the workspace to run as.
USER 1000

ENTRYPOINT ["/entrypoint.sh"]
CMD ["tail", "-f", "/dev/null"]
