{% if env == "staging" %}
FROM fedora:38
{% else %}
FROM fedora:38
{% endif %}
LABEL \
    name="bodhi-base" \
    vendor="Fedora Infrastructure" \
    license="MIT"
{% if env == "staging" %}
RUN curl -o /etc/yum.repos.d/infra-tags.repo https://infrastructure.fedoraproject.org/infra/ansible/files/common/fedora-infra-tags.repo
RUN curl -o /etc/yum.repos.d/infra-tags-stg.repo https://infrastructure.fedoraproject.org/infra/ansible/files/common/fedora-infra-tags-stg.repo
{% else %}
RUN curl -o /etc/yum.repos.d/infra-tags.repo https://infrastructure.fedoraproject.org/infra/ansible/files/common/fedora-infra-tags.repo
{% endif %}
{% if env == "staging" %}
RUN dnf install -y bodhi-server python3-pyramid_sawing python3-gunicorn sed --refresh
{% else %}
RUN dnf install -y bodhi-server-{{bodhi_version}} python3-pyramid_sawing python3-gunicorn sed
{% endif %}

# Temporary patch for testing fix for pod crashes
RUN curl https://github.com/fedora-infra/bodhi/commit/0c302e26003756544f63bbeba016f75f3f037a03.patch -o /tmp/dbTimeout.patch
RUN patch -p3 -ruN -d /usr/lib/python3.11/site-packages/bodhi < /tmp/dbTimeout.patch

# link the static files for a simpler httpd.conf
RUN ln -s $(python3 -Ic "import sysconfig; print(sysconfig.get_path('purelib', 'rpm_prefix'))")/bodhi/server/static/ /srv/bodhi-static

# Set up krb5
RUN rm -f /etc/krb5.conf && \
    ln -sf /etc/bodhi/krb5.conf /etc/krb5.conf && \
    ln -sf /etc/keytabs/koji-keytab /etc/krb5.bodhi_bodhi{{ env_suffix }}.fedoraproject.org.keytab
ENV USER=openshift
