nextcloud/Dockerfile

87 lines
2.8 KiB
Docker

FROM debian:11-slim
WORKDIR /root
ARG PHPVERSION=8.1
#Initial update packges
RUN apt update && apt upgrade -y
# Language setup
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt install locales -y \
&& apt auto-remove -y \
&& apt clean -y
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \
&& locale-gen
# Installing basic tools
RUN apt install bzip2 zip unzip git gnupg2 ca-certificates lsb-release apt-transport-https wget curl nano vim -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
#Download and extract Nextcloud....
RUN wget https://download.nextcloud.com/server/releases/latest.tar.bz2 \
&& tar -xvf latest.tar.bz2 \
&& rm -v latest.tar.bz2
# Installing and configuring nginx
RUN apt install nginx -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
# Installing redis
RUN apt install redis -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
#Adding Repo
RUN wget https://packages.sury.org/php/apt.gpg \
&& apt-key add apt.gpg \
&& rm apt.gpg \
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list \
&& apt update
#Installing and configure PHP
RUN apt install php${PHPVERSION}-fpm php${PHPVERSION} -y --no-install-recommends \
&& mkdir /run/php/
#Installing Required PHP Modules
RUN bash -c 'apt install -y php${PHPVERSION}-{cli,bcmath,bz2,intl,common,ctype,curl,dom,gd,mbstring,posix,simplexml,xmlreader,xmlwriter,zip} --no-install-recommends'
#Installing database connector PHP Modules
RUN bash -c 'apt install -y php${PHPVERSION}-mysql --no-install-recommends'
#Installing recommended PHP Modules
RUN bash -c 'apt install -y php${PHPVERSION}-{fileinfo,bz2,intl} --no-install-recommends'
#Installing Optional Specific app PHP Modules
RUN bash -c 'apt install -y php${PHPVERSION}-{gmp,exif} --no-install-recommends'
#Installing Optional server performance enhancement PHP Modules
RUN bash -c 'apt install -y php${PHPVERSION}-{apcu,memcached,redis} --no-install-recommends'
#Installing optional PHP modules and tools for preview generation #Maybe add LibreOffice here
RUN bash -c 'apt install -y php${PHPVERSION}-imagick imagemagick ffmpeg libreoffice --no-install-recommends'
#Installing Optional cli enhancement PHP Modules
#RUN bash -c 'apt install -y php${PHPVERSION}-pcntl --no-install-recommends'
# Delete default stuff
RUN rm -rv /var/www/html/index.nginx-debian.html \
/etc/php/ \
/etc/nginx/ \
/root/nextcloud/config/
#Autoconfig defaults
RUN mkdir -pv default_configs/etc/ default_configs/var/
COPY buildfiles/etc/ default_configs/etc/
COPY buildfiles/var/ default_configs/var/
#autostart files
COPY buildfiles/auto_config.sh .
COPY buildfiles/start_services.sh .
RUN chmod +x auto_config.sh
RUN chmod +x start_services.sh
CMD ["./start_services.sh"]