You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
4.4 KiB

FROM cloudron/base:3.0.0@sha256:455c70428723e3a823198c57472785437eb6eab082e79b3ff04ea584faf46e92
RUN mkdir -p /app/code /app/data /app/data/modules /app/data/config /app/data/assets /app/data/runtime /app/data/uploads /app/data/tmp/config
WORKDIR /app/code
# keep the prefork linking below a2enmod since it removes dangling mods-enabled (!)
# perl kills setlocale() in php -
RUN a2disconf other-vhosts-access-log && \
echo "Listen 80" > /etc/apache2/ports.conf && \
a2enmod rewrite headers rewrite expires cache php7.4 && \
a2dismod perl && \
rm /etc/apache2/sites-enabled/* && \
sed -e 's,^ErrorLog.*,ErrorLog "|/bin/cat",' -i /etc/apache2/apache2.conf && \
ln -sf /app/data/apache/mpm_prefork.conf /etc/apache2/mods-enabled/mpm_prefork.conf && \
ln -sf /app/data/apache/app.conf /etc/apache2/sites-enabled/app.conf
COPY apache/ /app/code/apache/
# configure mod_php
RUN crudini --set /etc/php/7.4/apache2/php.ini PHP upload_max_filesize 64M && \
crudini --set /etc/php/7.4/apache2/php.ini PHP post_max_size 64M && \
crudini --set /etc/php/7.4/apache2/php.ini PHP memory_limit 128M && \
crudini --set /etc/php/7.4/apache2/php.ini Session session.save_path /run/app/sessions && \
crudini --set /etc/php/7.4/apache2/php.ini Session session.gc_probability 1 && \
crudini --set /etc/php/7.4/apache2/php.ini Session session.gc_divisor 100
RUN cp /etc/php/7.4/apache2/php.ini /etc/php/7.4/cli/php.ini
RUN ln -s /app/data/php.ini /etc/php/7.4/apache2/conf.d/99-cloudron.ini && \
ln -s /app/data/php.ini /etc/php/7.4/cli/conf.d/99-cloudron.ini
# install RPAF module to override HTTPS, SERVER_PORT, HTTP_HOST based on reverse proxy headers
RUN mkdir /app/code/rpaf && \
curl -L | 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/" > /etc/apache2/mods-available/rpaf.load && a2enmod rpaf
# ioncube. the extension dir comes from php -i | grep extension_dir
# extension has to appear first, otherwise will error with "The Loader must appear as the first entry in the php.ini file"
RUN mkdir /tmp/ioncube && \
curl | tar zxvf - -C /tmp/ioncube && \
cp /tmp/ioncube/ioncube/ /usr/lib/php/20190902/ && \
rm -rf /tmp/ioncube && \
echo "zend_extension=/usr/lib/php/20190902/" > /etc/php/7.4/apache2/conf.d/00-ioncube.ini && \
echo "zend_extension=/usr/lib/php/20190902/" > /etc/php/7.4/cli/conf.d/00-ioncube.ini
# configure supervisor
ADD supervisor/ /etc/supervisor/conf.d/
RUN sed -e 's,^logfile=.*$,logfile=/run/supervisord.log,' -i /etc/supervisor/supervisord.conf
RUN npm install -g grunt-cli less
RUN curl -L${VERSION}.tar.gz | tar zx --strip-components 1 -C /app/code
RUN rm /app/code/index-test.php
RUN mv /app/code/.htaccess.dist /app/code/.htaccess
RUN sed -i "/$DEBUG_TEXT/d" ./index.php
RUN sed -i "/$ENV_TEXT/d" ./index.php
RUN npm install
RUN composer install
RUN grunt build-assets
RUN grunt build-theme
RUN rm /app/code/protected/config/common.php
COPY config.example /app/code/protected/config/common.php
RUN rm -rf /app/code/protected/modules && ln -s /app/data/modules /app/code/protected/modules
RUN cp -r /app/code/protected/config/* /app/data/tmp/config && rm -rf /app/code/protected/config && ln -s /app/data/config /app/code/protected/config
RUN rm -rf /app/code/assets && ln -s /app/data/assets /app/code/assets
RUN rm -rf /app/code/uploads && ln -sf /app/data/uploads /app/code/uploads
RUN rm -rf /app/code/protected/runtime && ln -s /app/data/runtime /app/code/protected/runtime
# add code
COPY /app/code/
RUN chown -R www-data:www-data /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 chmod +x /app/code/
CMD [ "/app/code/" ]