{% extends "base.j2" %}
{% set bento__pip_cmd="pip3" %}
{% block SETUP_BENTO_BASE_IMAGE %}
{{ super() }}

USER root

# Install helpers
{% call common.RUN(__enable_buildkit__) -%} {{ common.mount_cache("/var/cache/yum") }} {% endcall -%} set -eux && \
    yum upgrade -y && \
    yum install -y amazon-linux-extras curl ca-certificates gcc gcc-c++ make bash shadow-utils && \
    amazon-linux-extras enable python{{ __options__python_version }} && \
    yum install -y python{{ __options__python_version.split(".") | join('') }} python{{ __options__python_version.split(".") | join('') }}-devel && \
    yum groupinstall -y "Development Tools"
{% if __options__system_packages is not none %}
# Install user-defined system package
{% call common.RUN(__enable_buildkit__) -%} {{ common.mount_cache("/var/cache/yum") }} {% endcall -%} set -eux && \
    yum install -y {{ __options__system_packages | join(' ') }}
{% endif -%}
RUN ln -sf /usr/bin/python{{ __options__python_version }} /usr/bin/python3 && \
    ln -sf /usr/bin/pip{{ __options__python_version }} /usr/bin/pip3
{% endblock %}
