ARG IMG=$MOODLE_IMG
FROM ${IMG}
LABEL maintainer="Adapted from: Ernesto Serrano <info@ernesto.es>"


USER root
COPY src/rootfs/ /
COPY 02-configure-moodle.sh /docker-entrypoint-init.d/
COPY 03-plugins.sh /docker-entrypoint-init.d/
COPY src/rootfs/var/www/html/admin/cli/isinstalled.php /
COPY is_moodle_ready.sh /
COPY nginx.conf /etc/nginx/
RUN echo "user=nobody" >> /etc/php7/php-fpm.d/www.conf
RUN echo "group=nobody" >> /etc/php7/php-fpm.d/www.conf
RUN apk add --no-cache dcron libcap && \
    chown nobody:nobody /usr/sbin/crond && \
    setcap cap_setgid=ep /usr/sbin/crond
RUN apk add php7-sodium
