{% extends "base_debian.j2" %}
{% block SETUP_BENTO_BASE_IMAGE %}
{{ super() }}

RUN --mount=type=cache,from=cached,sharing=shared,target=/var/cache/apt \
    --mount=type=cache,from=cached,sharing=shared,target=/var/lib/apt bash <<EOF
apt-get update -y
apt-get install -y --no-install-recommends --allow-remove-essential \
		software-properties-common curl

# add deadsnakes ppa to install python
add-apt-repository ppa:deadsnakes/ppa
apt-get update -y

apt-get install -y --no-install-recommends --allow-remove-essential \
		{% if "ubuntu22.04" in __base_image__ and __options__python_version == "3.10" %}python{{ __options__python_version }}-jammy{% else %}python{{ __options__python_version }}{% endif %} \
		python{{ __options__python_version }}-dev \
		python{{ __options__python_version }}-distutils

apt-get clean
EOF

RUN ln -sf /usr/bin/python{{ __options__python_version }} /usr/bin/python3 && \
	ln -sf /usr/bin/pip{{ __options__python_version }} /usr/bin/pip3

RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
    python3 get-pip.py && \
    rm -rf get-pip.py

{% endblock %}
{% block SETUP_BENTO_ENVARS %}

SHELL [ "/bin/bash", "-eo", "pipefail", "-c" ]

{{ super() }}
{% endblock %}
