2022-12-16 23:42:16 +00:00
|
|
|
FROM alpine:3.15
|
2021-02-08 08:55:35 +00:00
|
|
|
|
|
|
|
LABEL maintainer="Varakh<varakh@varakh.de>"
|
|
|
|
|
2023-04-06 20:53:19 +00:00
|
|
|
ENV APP_HOME=/var/www/html/application \
|
|
|
|
PHP_MEMORY_LIMIT=512M \
|
|
|
|
MAX_UPLOAD=1024M \
|
|
|
|
PHP_MAX_FILE_UPLOAD=200 \
|
|
|
|
PHP_MAX_POST=1024M
|
2021-02-08 16:19:59 +00:00
|
|
|
|
2021-02-08 08:55:35 +00:00
|
|
|
# setup folder structure
|
2021-02-08 16:19:59 +00:00
|
|
|
RUN mkdir -p ${APP_HOME}/data/snapshots && \
|
|
|
|
mkdir -p ${APP_HOME}/log && \
|
|
|
|
touch ${APP_HOME}/log/application.log && \
|
|
|
|
mkdir -p ${APP_HOME}/config
|
2021-02-08 08:55:35 +00:00
|
|
|
|
2023-04-06 20:53:19 +00:00
|
|
|
# entrypoint
|
|
|
|
ADD docker/configure.php /configure.php
|
|
|
|
|
2021-02-08 08:55:35 +00:00
|
|
|
# add upstream application
|
2021-02-08 16:19:59 +00:00
|
|
|
ADD src ${APP_HOME}/src
|
|
|
|
ADD public ${APP_HOME}/public
|
|
|
|
ADD composer.json ${APP_HOME}/composer.json
|
|
|
|
ADD composer.lock ${APP_HOME}/composer.lock
|
|
|
|
ADD data ${APP_HOME}/data
|
|
|
|
ADD config ${APP_HOME}/config
|
2021-02-08 08:55:35 +00:00
|
|
|
|
|
|
|
# install dependencies
|
2023-04-06 20:53:19 +00:00
|
|
|
RUN cp ${APP_HOME}/config/env.example ${APP_HOME}/config/env && \
|
|
|
|
apk add --update --no-cache \
|
|
|
|
bash \
|
2021-02-08 08:55:35 +00:00
|
|
|
nginx \
|
|
|
|
s6 \
|
|
|
|
curl \
|
|
|
|
git \
|
|
|
|
php7 \
|
|
|
|
php7-fpm \
|
|
|
|
php7-cli \
|
|
|
|
php7-intl \
|
|
|
|
php7-curl \
|
|
|
|
php7-json \
|
|
|
|
php7-dom \
|
|
|
|
php7-simplexml \
|
|
|
|
php7-pcntl \
|
|
|
|
php7-posix \
|
|
|
|
php7-mcrypt \
|
|
|
|
php7-session \
|
|
|
|
php7-gd \
|
|
|
|
php7-phar \
|
|
|
|
php7-fileinfo \
|
|
|
|
php7-mbstring \
|
|
|
|
php7-ctype \
|
|
|
|
php7-ldap \
|
2022-01-19 19:44:01 +00:00
|
|
|
php7-openssl \
|
2021-02-08 08:55:35 +00:00
|
|
|
php7-pecl-memcached \
|
|
|
|
memcached \
|
|
|
|
ca-certificates && \
|
|
|
|
rm -rf /var/cache/apk/* && \
|
|
|
|
apk add gnu-libiconv --update-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community/ --allow-untrusted && \
|
2022-01-19 19:44:01 +00:00
|
|
|
# set environments/php
|
2021-02-08 08:55:35 +00:00
|
|
|
sed -i "s|;*memory_limit =.*|memory_limit = ${PHP_MEMORY_LIMIT}|i" /etc/php7/php.ini && \
|
|
|
|
sed -i "s|;*upload_max_filesize =.*|upload_max_filesize = ${MAX_UPLOAD}|i" /etc/php7/php.ini && \
|
|
|
|
sed -i "s|;*max_file_uploads =.*|max_file_uploads = ${PHP_MAX_FILE_UPLOAD}|i" /etc/php7/php.ini && \
|
|
|
|
sed -i "s|;*post_max_size =.*|post_max_size = ${PHP_MAX_POST}|i" /etc/php7/php.ini && \
|
2022-01-19 19:44:01 +00:00
|
|
|
# prepare php
|
|
|
|
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
|
2021-02-08 08:55:35 +00:00
|
|
|
# prepare application
|
2021-02-08 16:19:59 +00:00
|
|
|
cd ${APP_HOME} && composer install && \
|
2021-02-08 08:55:35 +00:00
|
|
|
# clean up and permissions
|
|
|
|
rm -rf /var/cache/apk/* && \
|
2021-02-08 16:19:59 +00:00
|
|
|
chown nobody:nginx -R ${APP_HOME}
|
2021-02-08 08:55:35 +00:00
|
|
|
|
|
|
|
# Add nginx config
|
|
|
|
ADD docker/nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
2023-04-06 20:53:19 +00:00
|
|
|
# Add required environment variables to php-fpm
|
|
|
|
RUN echo "env[ENV_DIR]=%%%ENV_DIR%%%" >> /etc/php7/php-fpm.d/www.conf
|
|
|
|
|
2021-02-08 08:55:35 +00:00
|
|
|
EXPOSE 80
|
|
|
|
|
|
|
|
# add overlay
|
|
|
|
ADD docker/s6 /etc/s6/
|
|
|
|
|
|
|
|
# expose start
|
2023-04-06 20:53:19 +00:00
|
|
|
CMD /usr/bin/php /configure.php && exec s6-svscan /etc/s6/
|