### ### Meta Information ### ARG FROM_IMAGE="localhost/debian" FROM ${FROM_IMAGE} # deploy options # -p (port) and -v (volume) both go host:container LABEL deploy.default="-p 10080:80 \ -v /tank/files/user/mar:/vol/files/mar/files \ -v /tank/files/db/nextcloud:/vol/db" # php and postgres versions. will depend on version of debian we are running ARG phpv=7.3 ARG psqlv=11 # database variables ENV DBUSER=ncadmin ENV DBNAME=nextcloud ### ### General Setup ### # install packages we want RUN apt update -y && apt install -y systemd sudo wget apache2 php-fpm \ php-gd php-zip php-pgsql php-curl php-mbstring php-intl php-imagick \ php-xml php-json redis-server php-redis postgresql postgresql-doc \ unzip php-ldap # this is a bug workaround b/c testing is currently between versions of php. should be removed ideally RUN update-alternatives --set php /usr/bin/php7.3 # change www-data's UID to the file owner UID RUN usermod --uid 5000 www-data && \ groupmod --gid 5000 www-data && \ chown -R www-data:www-data /var/www # make directories that we will be mounting into RUN mkdir -p /vol/files/mar/files /vol/database && chown -R www-data:www-data /vol # copy our custom scripts COPY resources/bin/ /usr/local/bin/ ### ### Apache ### # enable modules we need RUN a2enmod rewrite headers env dir mime proxy_fcgi && a2enconf php${phpv}-fpm # copy site config COPY resources/apache/nextcloud.conf /etc/apache2/sites-available/ WORKDIR /etc/apache2/sites-enabled RUN rm 000-default.conf && ln -s ../sites-available/nextcloud.conf ### ### PHP ### # enable PHP interpreter RUN systemctl enable php${phpv}-fpm # copy php configuration COPY resources/php/php.ini /etc/php/${phpv}/fpm/ COPY resources/php/www.conf /etc/php/${phpv}/fpm/pool.d/ ### ### Redis ### # copy redis config COPY --chown=redis:redis resources/redis.conf /etc/redis/ # add www-data to redis group so it can use the socket RUN usermod -a -G redis www-data ### ### PostgreSQL ### ### # configure PostgreSQL access COPY --chown=postgres:postgres resources/pg_hba.conf /etc/postgresql/${psqlv}/main/pg_hba.conf ### ### Nextcloud ### # download nextcloud WORKDIR /var/www/html RUN wget https://download.nextcloud.com/server/releases/latest.zip && \ unzip -q latest.zip && \ chown -R www-data:www-data nextcloud && \ rm latest.zip # copy nextcloud configuration file COPY --chown=www-data:www-data resources/my.config.php nextcloud/config/ ### ### Crontab ### WORKDIR /root COPY resources/crontab . RUN crontab -u www-data crontab && rm crontab ### ### Systemdfile ### COPY Systemdfile /root/ RUN chmod +x /root/Systemdfile