FROM registry.brunner.ninja/feedc0de/php-apache-postgres

RUN pacman -Syu --noconfirm git sudo base-devel \
 && cd /tmp \
 && sudo -u http git clone https://aur.archlinux.org/phppgadmin.git \
 && cd phppgadmin \
 && sudo -u http makepkg -s \
 && pacman -U --noconfirm *.pkg.* \
 && ls \
 && cd .. \
 && rm -Rfv phppgadmin \
 && pacman -Rcnsu --noconfirm git sudo base-devel \
 && pacman -Sc --noconfirm \
 && rm -v /var/log/pacman.log /var/lib/pacman/sync/*

RUN sed -i 's|^DocumentRoot.*|DocumentRoot "/usr/share/webapps/phppgadmin"|' /etc/httpd/conf/httpd.conf \
 && echo '<Directory "/usr/share/webapps/phppgadmin">' >> /etc/httpd/conf/httpd.conf \
 && echo '    DirectoryIndex index.php' >> /etc/httpd/conf/httpd.conf \
 && echo '    AllowOverride All' >> /etc/httpd/conf/httpd.conf \
 && echo '    Options FollowSymlinks' >> /etc/httpd/conf/httpd.conf \
 && echo '    Require all granted' >> /etc/httpd/conf/httpd.conf \
 && echo '</Directory>' >> /etc/httpd/conf/httpd.conf
