build files for making podman containers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

118 lines
2.7 KiB

###
### Meta Information
###
FROM localhost/debian
# deploy options
# -p (port) and -v (volume) both go host:container
LABEL deployopts="\
-p 9080:80 \
-v /tank/files/user/mar:/vol/files/mar/files \
-v /tank/files/db/nextcloud:/vol/db"
# make sure mount directories exist
RUN mkdir -p /vol/files/mar/files /vol/db
# Build Variables
# versions of php and postgres
ARG phpv=7.3
ARG psqlv=11
# uid that the files owner user should have
ARG FILESUID=5000
# Environment Variables
# database name and user
ENV DBUSER=ncadmin
ENV DBNAME=nextcloud
# put environment variables in /etc/environment so we can access them from cron scripts
RUN echo "DBUSER=$DBUSER" >> /etc/environment && \
echo "DBNAME=$DBNAME" >> /etc/environment
###
### General Setup
###
# install packages we want
RUN apt update -y && apt install -y apache2 php-fpm php-gd php-zip \
php-pgsql php-curl php-mbstring php-intl php-imagick php-xml \
php-json redis php-redis postgresql postgresql-doc php-ldap
# change www-data's UID to the file owner UID
RUN usermod --uid $FILESUID www-data && \
groupmod --gid $FILESUID www-data && \
chown -R www-data:www-data /var/www /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/redis.conf
# 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 && \
echo "Unzipping ..." && \
unzip -q latest.zip && \
chown -R www-data:www-data nextcloud && \
rm latest.zip
# copy nextcloud config
COPY --chown=www-data:www-data resources/my.config.php nextcloud/config/
###
### Crontab
###
COPY resources/crontab /root/
# crontab for www-data
RUN crontab -u www-data /root/crontab
###
### Bugfix
###
# push the fixed systemd file for redis
COPY bugfix/redis.service /etc/systemd/system/redis.service
# execute command to workaround bug in cron
COPY bugfix/cronfix /root/
RUN chmod +x /root/cronfix && /root/cronfix