nextcloud/Dockerfile

87 lines
2.8 KiB
Docker
Raw Normal View History

2022-10-07 15:51:20 +05:00
FROM debian:11-slim
WORKDIR /root
ARG PHPVERSION=8.1
#Initial update packges
2022-10-07 20:27:53 +05:00
RUN apt update && apt upgrade -y
2022-10-07 15:51:20 +05:00
# 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
2022-10-07 20:27:53 +05:00
RUN apt install bzip2 zip unzip git gnupg2 ca-certificates lsb-release apt-transport-https wget curl nano vim -y --no-install-recommends \
2022-10-07 15:51:20 +05:00
&& apt auto-remove -y \
&& apt clean -y
2022-10-07 20:27:53 +05:00
#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
2022-10-07 16:10:23 +05:00
RUN apt install nginx -y --no-install-recommends \
&& apt auto-remove -y \
2022-10-07 18:02:43 +05:00
&& apt clean -y
2022-10-07 16:10:23 +05:00
# Installing redis
RUN apt install redis -y --no-install-recommends \
2022-10-07 15:51:20 +05:00
&& apt auto-remove -y \
&& apt clean -y
2022-10-07 16:10:23 +05:00
#Adding Repo
RUN wget https://packages.sury.org/php/apt.gpg \
&& apt-key add apt.gpg \
&& rm apt.gpg \
2022-10-07 16:34:39 +05:00
&& echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list \
&& apt update
2022-10-07 16:10:23 +05:00
#Installing and configure PHP
RUN apt install php${PHPVERSION}-fpm php${PHPVERSION} -y --no-install-recommends \
&& mkdir /run/php/
2022-10-07 16:10:23 +05:00
#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'
2022-10-07 16:10:23 +05:00
#Installing database connector PHP Modules
2022-10-07 16:41:24 +05:00
RUN bash -c 'apt install -y php${PHPVERSION}-mysql --no-install-recommends'
2022-10-07 16:10:23 +05:00
#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'
2022-10-07 16:10:23 +05:00
#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'
2022-10-07 16:10:23 +05:00
#Installing Optional cli enhancement PHP Modules
2022-10-07 18:02:43 +05:00
#RUN bash -c 'apt install -y php${PHPVERSION}-pcntl --no-install-recommends'
2022-10-07 16:10:23 +05:00
2022-10-07 18:02:43 +05:00
# Delete default stuff
2022-10-07 19:31:34 +05:00
RUN rm -rv /var/www/html/index.nginx-debian.html \
2022-10-07 19:49:52 +05:00
/etc/php/ \
2022-10-08 03:38:12 +05:00
/etc/nginx/ \
/root/nextcloud/config/
2022-10-07 16:10:23 +05:00
2022-10-07 18:02:43 +05:00
#Autoconfig defaults
RUN mkdir -pv default_configs/etc/ default_configs/var/
2022-10-07 19:09:27 +05:00
COPY buildfiles/etc/ default_configs/etc/
COPY buildfiles/var/ default_configs/var/
2022-10-07 15:51:20 +05:00
2022-10-07 18:02:43 +05:00
#autostart files
2022-10-07 19:09:27 +05:00
COPY buildfiles/auto_config.sh .
2022-10-07 18:02:43 +05:00
COPY buildfiles/start_services.sh .
2022-10-07 19:09:27 +05:00
RUN chmod +x auto_config.sh
2022-10-07 18:02:43 +05:00
RUN chmod +x start_services.sh
CMD ["./start_services.sh"]