diff --git a/Dockerfile b/Dockerfile index c03d283..6e93036 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,10 +25,7 @@ RUN apt install zip unzip git gnupg2 ca-certificates lsb-release apt-transport-h # Installing and configuring nginx RUN apt install nginx -y --no-install-recommends \ && apt auto-remove -y \ - && apt clean -y \ - && rm -v /etc/nginx/sites-enabled/default /var/www/html/index.nginx-debian.html -COPY buildfiles/nextcloud_nginx.conf /etc/nginx/sites-available/ -RUN ln -s /etc/nginx/sites-available/nextcloud_nginx.conf /etc/nginx/sites-enabled/ + && apt clean -y # Installing redis RUN apt install redis -y --no-install-recommends \ @@ -64,10 +61,20 @@ RUN bash -c 'apt install -y php${PHPVERSION}-{apcu,memcached,redis} --no-install 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' +#RUN bash -c 'apt install -y php${PHPVERSION}-pcntl --no-install-recommends' +# Delete default stuff +#nginx +RUN rm -v /etc/nginx/sites-enabled/default /var/www/html/index.nginx-debian.html +#Autoconfig defaults +RUN mkdir /root/default_configs +COPY buildfiles/auto_config.sh . +COPY buildfiles/nextcloud_nginx.conf /root/default_configs/ -CMD ["bash"] +#autostart files +COPY buildfiles/start_services.sh . +RUN chmod +x start_services.sh +CMD ["./start_services.sh"] diff --git a/buildfiles/auto_config.sh b/buildfiles/auto_config.sh new file mode 100644 index 0000000..64aaf5c --- /dev/null +++ b/buildfiles/auto_config.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if ![ -f /etc/nginx/sites-enabled/nextcloud_nginx.conf] +then + cp -v /root/default_configs/nextcloud_nginx.conf /etc/nginx/sites-available/ + ln -sv /etc/nginx/sites-available/nextcloud_nginx.conf /etc/nginx/sites-enabled/ +fi + + diff --git a/buildfiles/start_services.sh b/buildfiles/start_services.sh new file mode 100644 index 0000000..55ae31d --- /dev/null +++ b/buildfiles/start_services.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +#Default auto configs +/root/auto_config.sh + +#Start Php-fpm +/usr/sbin/php-fpm7.2 --nodaemonize --fpm-config /etc/php/7.2/fpm/php-fpm.conf & + +#Start Nginx +/usr/sbin/nginx -g 'daemon off; master_process on;' & + + + +# Wait for any process to exit +wait -n +# Exit with status of process that exited first +exit $? diff --git a/docker-compose.yml b/docker-compose.yml index f172d64..9d0c9a5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,5 +4,7 @@ services: app: build: . image: git.shihaam.me/dockerfiles/nextcloud + volumes: + - ./configs/etc/nginx/sites-enabled:/etc/nginx/sites-enabled ports: - 8000:80