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

# Install helpers
{% call common.RUN(__enable_buildkit__) -%} {{ common.mount_cache("/var/cache/apk") }} {% endcall -%} set -eux && \
    apk add --update bash gcc libc-dev shadow musl-dev build-base linux-headers g++ curl

ENV ENV /root/.bashrc

{% if __options__system_packages is not none %}
# Install user-defined system package
{% call common.RUN(__enable_buildkit__) -%} {{ common.mount_cache("/var/cache/apk") }} {% endcall -%} set -eux \
    apk add --update {{ __options__system_packages | join(' ') }}
{% endif -%}
{% endblock %}

{% block SETUP_BENTO_USER %}
ARG BENTO_USER={{ bento__user }}
ARG BENTO_USER_UID={{ bento__uid_gid }}
ARG BENTO_USER_GID={{ bento__uid_gid }}
RUN addgroup -g $BENTO_USER_GID -S $BENTO_USER && adduser -u $BENTO_USER_UID -G $BENTO_USER -S $BENTO_USER
{% endblock %}
