FROM nextcloud:29

ENV NEXTCLOUD_UPDATE=1
ENV NEXTCLOUD_ADMIN_USER=repod
ENV NEXTCLOUD_ADMIN_PASSWORD=repod
ENV NEXTCLOUD_INIT_HTACCESS=1
ENV SQLITE_DATABASE=repod

RUN apt-get update && \
    apt-get install -y nodejs npm sqlite3 && \
    rm -f /usr/local/etc/php/conf.d/opcache-recommended.ini && \
    /entrypoint.sh true

USER www-data

COPY --chown=www-data:www-data . apps/repod
RUN cd apps/repod && make build && cd - && \
    php occ app:install gpoddersync && \
    php occ app:enable repod && \
    php occ config:system:set debug --value=true

USER root