Created
January 17, 2020 06:37
-
-
Save XTalandier/15a157733742c01fff1f2191cae31096 to your computer and use it in GitHub Desktop.
Cloudron php 7.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM cloudron/base:1.0.0@sha256:147a648a068a2e746644746bbfb42eb7a50d682437cead3c67c933c546357617 | |
RUN mkdir -p /app/code | |
WORKDIR /app/code | |
# PHP 7.3 | |
RUN apt-get update && apt install -y software-properties-common | |
RUN add-apt-repository ppa:ondrej/php | |
RUN apt update | |
RUN apt-get install -y php7.3 | |
RUN apt-get install -y php libapache2-mod-php7.3 crudini \ | |
# php-redis \ | |
php-apcu \ | |
php-bcmath \ | |
php-bz2 \ | |
php-curl \ | |
php-date \ | |
php-enchant \ | |
php-gd \ | |
php-geoip \ | |
php-gettext \ | |
php-imap \ | |
php-json \ | |
php-log \ | |
php-mbstring \ | |
php-mime-type \ | |
php-mysql \ | |
php-readline \ | |
php-soap \ | |
php-sql-formatter \ | |
php-sqlite3 \ | |
php-tcpdf \ | |
php-timer \ | |
php-twig \ | |
php-uuid \ | |
php-validate \ | |
php-xml \ | |
php-xml-svg \ | |
php-zip \ | |
php7.3-intl \ | |
cron \ | |
apache2-dev \ | |
build-essential \ | |
&& rm -rf /var/cache/apt /var/lib/apt/lists /etc/ssh_host_* | |
# configure apache | |
RUN rm /etc/apache2/sites-enabled/* | |
RUN sed -e 's,^ErrorLog.*,ErrorLog "|/bin/cat",' -i /etc/apache2/apache2.conf | |
COPY apache/mpm_prefork.conf /etc/apache2/mods-available/mpm_prefork.conf | |
COPY apache/lamp.conf /etc/apache2/sites-enabled/lamp.conf | |
RUN echo "Listen 80" > /etc/apache2/ports.conf | |
RUN a2disconf other-vhosts-access-log | |
RUN a2enmod rewrite headers rewrite expires cache | |
#RUN sudo pecl update-channels && sudo pecl install intl | |
# configure mod_php | |
RUN crudini --set /etc/php/7.3/apache2/php.ini PHP upload_max_filesize 64M && \ | |
crudini --set /etc/php/7.3/apache2/php.ini PHP post_max_size 64M && \ | |
crudini --set /etc/php/7.3/apache2/php.ini PHP memory_limit 128M && \ | |
crudini --set /etc/php/7.3/apache2/php.ini Session session.save_path /run/app/sessions && \ | |
crudini --set /etc/php/7.3/apache2/php.ini Session session.gc_probability 1 && \ | |
crudini --set /etc/php/7.3/apache2/php.ini Session session.gc_divisor 100 | |
RUN mv /etc/php/7.3/apache2/php.ini /etc/php/7.3/apache2/php.ini.orig && ln -sf /app/data/php.ini /etc/php/7.3/apache2/php.ini | |
# install RPAF module to override HTTPS, SERVER_PORT, HTTP_HOST based on reverse proxy headers | |
# https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-web-server-and-reverse-proxy-for-apache-on-one-ubuntu-16-04-server | |
RUN mkdir /app/code/rpaf && \ | |
curl -L https://github.com/gnif/mod_rpaf/tarball/669c3d2ba72228134ae5832c8cf908d11ecdd770 | tar -C /app/code/rpaf -xz --strip-components 1 -f - && \ | |
cd /app/code/rpaf && \ | |
make && \ | |
make install && \ | |
rm -rf /app/code/rpaf | |
# configure rpaf | |
RUN echo "LoadModule rpaf_module /usr/lib/apache2/modules/mod_rpaf.so" > /etc/apache2/mods-available/rpaf.load && a2enmod rpaf | |
# phpMyAdmin | |
RUN mkdir -p /app/code/phpmyadmin && \ | |
curl -L https://files.phpmyadmin.net/phpMyAdmin/4.8.3/phpMyAdmin-4.8.3-all-languages.tar.gz | tar zxvf - -C /app/code/phpmyadmin --strip-components=1 | |
COPY phpmyadmin-config.inc.php /app/code/phpmyadmin/config.inc.php | |
# configure cron | |
RUN rm -rf /var/spool/cron && ln -s /run/cron /var/spool/cron | |
# clear out the crontab | |
RUN rm -f /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* && truncate -s0 /etc/crontab | |
# configure supervisor | |
ADD supervisor/ /etc/supervisor/conf.d/ | |
RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf | |
# add code | |
COPY start.sh index.php crontab.template credentials.template phpmyadmin_login.template /app/code/ | |
# lock www-data but allow su - www-data to work | |
RUN passwd -l www-data && usermod --shell /bin/bash --home /app/data www-data | |
RUN a2dismod php7.2 | |
RUN a2enmod php7.3 | |
# make cloudron exec sane | |
WORKDIR /app/data | |
# SSH keys | |
RUN mkdir /app/data/sshkeys | |
RUN touch /app/data/sshkeys/id_rsa | |
RUN echo " IdentityFile /app/data/sshkeys/id_rsa" >> /etc/ssh/ssh_config | |
CMD [ "/app/code/start.sh" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment