# ch-test-scope: standard
FROM centos:8

# This image has two purposes: (1) demonstrate we can build a CentOS 8 image
# and (2) provide avbuild environment for Charliecloud EPEL 8 RPMs.
#
# Quirks:
#
#   1. Install the dnf ovl plugin to work around RPMDB corruption when
#      building images with Docker and the OverlayFS storage driver.
#
#   2. Enable PowerTools repository, because some packages in EPEL depend on
#      it. Use sed(1) because we don't want to install `dnf-plugins-core` just
#      for this.
#
#   3. Install packages needed to build el8 rpms.
#
RUN dnf install -y --setopt=install_weak_deps=false \
                epel-release \
                'dnf-command(config-manager)' \
 && dnf config-manager --enable epel \
 && dnf config-manager --enable powertools \
 && dnf install -y --setopt=install_weak_deps=false \
                   --enablerepo=epel-playground \
                dnf-plugin-ovl \
                autoconf \
                automake \
                gcc \
                git \
                make \
                python3 \
                python3-sphinx \
                python3-sphinx_rtd_theme \
                rpm-build \
                rpmlint \
                rsync \
                wget \
 && dnf clean all

# CentOS's linker doesn't search these paths by default; add them because we
# will install stuff later into /usr/local.
RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/usrlocal.conf \
 && echo "/usr/local/lib64" >> /etc/ld.so.conf.d/usrlocal.conf \
 && ldconfig
