-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
also add Dockerfile.Alpine which is not finished but should install and configure all basic components which are needed
- Loading branch information
1 parent
4c21239
commit 4cf8bb2
Showing
3 changed files
with
98 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# DO NOT USE | ||
# There are still commands for ubuntu and/or apache in this script. But all needed components should be installed and configured correctly | ||
FROM php:7.4-fpm-alpine | ||
|
||
# some environment variables | ||
ENV TZ="Europe/Berlin" | ||
ENV MAX_EXECUTION_TIME="60" | ||
ENV MAX_INPUT_TIME="120" | ||
ENV POST_MAX_SIZE="16M" | ||
ENV UPLOAD_MAX_FILESIZE="16M" | ||
ENV MEMORY_LIMIT="512M" | ||
ENV CRON_INTERVAL="* * * * *" | ||
|
||
# install dependencies | ||
# set timezone and link extensions directory | ||
# create tsi base folder | ||
RUN apk — no-cache update \ | ||
&& apk upgrade \ | ||
&& apk add libzip-dev libpng-dev unzip tzdata memcached libmemcached-dev libpng-dev libjpeg gcc curl-dev freetype-dev libjpeg-turbo-dev autoconf build-base \ | ||
&& ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone \ | ||
&& ln -s $(php-config --extension-dir --extension-dir) /php_ext \ | ||
&& mkdir /opt/tsi | ||
|
||
# there is a bug by gd configuration of freetype, it needs to be installed at first to be able to enable freetype | ||
# https://github.com/docker-library/php/issues/926#issuecomment-567230723 | ||
# also install ioncube | ||
RUN docker-php-ext-configure gd --enable-gd --with-freetype --with-jpeg \ | ||
&& docker-php-ext-configure zip \ | ||
&& docker-php-ext-install -j$(nproc) gd curl zip bcmath pdo pdo_mysql opcache \ | ||
&& wget -O /tmp/ioncube.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz \ | ||
&& tar -xvzf /tmp/ioncube.tar.gz --directory=/tmp \ | ||
&& cp /tmp/ioncube/ioncube_loader_lin_7.4.so /php_ext/ioncube.so \ | ||
&& PHP_EXT_DIR=$(php-config --extension-dir --extension-dir) \ | ||
&& echo "zend_extension = $PHP_EXT_DIR/ioncube.so" > /usr/local/etc/php/conf.d/_ioncube.ini \ | ||
&& rm -rf /tmp/ | ||
|
||
# ioncube needs to be loaded as first plugin, as they are loaded in alphabetical order, we need to make it the first in line | ||
# also installing and enabling cache extensions and enable mod rewrite | ||
RUN printf '\n' | pecl install apcu \ | ||
&& printf '\n' | pecl install memcached \ | ||
&& printf '\n' | pecl install redis \ | ||
&& printf '\n' | pecl install mongodb \ | ||
&& PHP_EXT_DIR=$(php-config --extension-dir --extension-dir) && echo "extension=$PHP_EXT_DIR/memcached.so" > /usr/local/etc/php/conf.d/cache-extensions.ini \ | ||
&& PHP_EXT_DIR=$(php-config --extension-dir --extension-dir) && echo "extension=$PHP_EXT_DIR/apcu.so" >> /usr/local/etc/php/conf.d/cache-extensions.ini \ | ||
&& PHP_EXT_DIR=$(php-config --extension-dir --extension-dir) && echo "extension=$PHP_EXT_DIR/redis.so" >> /usr/local/etc/php/conf.d/cache-extensions.ini \ | ||
&& PHP_EXT_DIR=$(php-config --extension-dir --extension-dir) && echo "extension=$PHP_EXT_DIR/mongodb.so" >> /usr/local/etc/php/conf.d/cache-extensions.ini \ | ||
&& /usr/sbin/a2enmod rewrite | ||
|
||
# php configuration | ||
RUN echo "max_execution_time = ${MAX_EXECUTION_TIME}" > /usr/local/etc/php/conf.d/tsi-config.ini \ | ||
&&echo "max_input_time = ${MAX_INPUT_TIME}" >> /usr/local/etc/php/conf.d/tsi-config.ini \ | ||
&& echo "post_max_size = ${POST_MAX_SIZE}" >> /usr/local/etc/php/conf.d/tsi-config.ini \ | ||
&& echo "upload_max_filesize = ${UPLOAD_MAX_FILESIZE}" >> /usr/local/etc/php/conf.d/tsi-config.ini \ | ||
&& echo "allow_url_fopen = on" >> /usr/local/etc/php/conf.d/tsi-config.ini \ | ||
&& echo "memory_limit = ${MEMORY_LIMIT}" >> /usr/local/etc/php/conf.d/tsi-config.ini | ||
|
||
# create cronjob file to only execute if cron.php is available | ||
RUN echo "#!/bin/sh" > /opt/tsi/cron.sh \ | ||
&& echo "" >> /opt/tsi/cron.sh \ | ||
&& echo "if [ -f /var/www/html/inc/cron.php ]; then" >> /opt/tsi/cron.sh \ | ||
&& echo " echo 'Found cron.php file'" >> /opt/tsi/cron.sh \ | ||
&& echo " /usr/local/bin/php /var/www/html/inc/cron.php" >> /opt/tsi/cron.sh \ | ||
&& echo "fi" >> /opt/tsi/cron.sh \ | ||
&& chmod a+r /opt/tsi/cron.sh \ | ||
&& chmod a+x /opt/tsi/cron.sh | ||
|
||
# add cronjob which is executed every minute | ||
RUN echo "# tsi crontab import file" > /opt/tsi/crontab-file.txt \ | ||
&& echo "${CRON_INTERVAL} /opt/tsi/cron.sh > /dev/null 2>&1" >> /opt/tsi/crontab-file.txt \ | ||
&& crontab -u www-data /opt/tsi/crontab-file.txt | ||
|
||
# custom startscript to modify permissions | ||
RUN echo "#!/bin/sh" > /opt/tsi/start.sh \ | ||
&& echo "chown -c -R www-data: /var/www/html" >> /opt/tsi/start.sh \ | ||
&& echo "cron &" >> /opt/tsi/start.sh \ | ||
&& echo "apache2-foreground" >> /opt/tsi/start.sh \ | ||
&& chmod u+x /opt/tsi/start.sh | ||
|
||
# cleanup | ||
RUN rm /php_ext \ | ||
&& rm -rf /tmp/* \ | ||
&& rm /opt/tsi/crontab-file.txt | ||
|
||
# volumes | ||
VOLUME ["/var/www/html", "/var/www/html"] | ||
|
||
# entrypoint | ||
CMD ["/opt/tsi/start.sh"] |