mirror of
https://github.com/farmOS/farmOS.git
synced 2024-02-23 11:37:38 +01:00
94 lines
4.4 KiB
Docker
94 lines
4.4 KiB
Docker
# Inherit from the Drupal 9 image on Docker Hub.
|
|
FROM drupal:9.3
|
|
|
|
# Set the farmOS and composer project repository URLs and versions.
|
|
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
|
|
ARG FARMOS_VERSION=2.x
|
|
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
|
|
ARG PROJECT_VERSION=2.x
|
|
|
|
# Set Apache ServerName directive globally to suppress AH00558 message.
|
|
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
|
|
|
# Install the BCMath PHP extension.
|
|
RUN docker-php-ext-install bcmath
|
|
|
|
# Build and install the GEOS PHP extension.
|
|
# See https://git.osgeo.org/gitea/geos/php-geos
|
|
RUN apt-get update && apt-get install -y libgeos-dev \
|
|
&& curl -fsSL 'https://git.osgeo.org/gitea/geos/php-geos/archive/1.0.0.tar.gz' -o php-geos.tar.gz \
|
|
&& tar -xzf php-geos.tar.gz \
|
|
&& rm php-geos.tar.gz \
|
|
&& ( \
|
|
cd php-geos \
|
|
# Apply patches for PHP 8 compatibility.
|
|
# See https://git.osgeo.org/gitea/geos/php-geos/issues/26#issuecomment-8988
|
|
&& curl -fsSL 'https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0001-fix-test-for-7.3-int-vs-integer.patch?id=c92520ad57670448de1c44e58496b8b495827af2' -o 1.patch && patch -p1 < 1.patch \
|
|
&& curl -fsSL 'https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0002-fix-error-message-with-php-7-Wformat-warnings-raised.patch?id=c92520ad57670448de1c44e58496b8b495827af2' -o 2.patch && patch -p1 < 2.patch \
|
|
&& curl -fsSL 'https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch?id=c92520ad57670448de1c44e58496b8b495827af2' -o 3.patch && patch -p1 < 3.patch \
|
|
&& curl -fsSL 'https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0004-fix-all-zend_parse_parameters-call-to-use-zend_long.patch?id=c92520ad57670448de1c44e58496b8b495827af2' -o 4.patch && patch -p1 < 4.patch \
|
|
&& curl -fsSL 'https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0005-fix-for-8.0.0RC1.patch?id=c92520ad57670448de1c44e58496b8b495827af2' -o 5.patch && patch -p1 < 5.patch \
|
|
&& ./autogen.sh \
|
|
&& ./configure \
|
|
&& make \
|
|
&& make install \
|
|
) \
|
|
&& rm -r php-geos \
|
|
&& docker-php-ext-enable geos
|
|
|
|
# Set recommended PHP settings for farmOS.
|
|
# See https://farmos.org/hosting/installing/#requirements
|
|
RUN { \
|
|
echo 'memory_limit=256M'; \
|
|
echo 'max_execution_time=240'; \
|
|
echo 'max_input_time=240'; \
|
|
echo 'max_input_vars=5000'; \
|
|
echo 'post_max_size=100M'; \
|
|
echo 'upload_max_filesize=100M'; \
|
|
echo 'expose_php=Off'; \
|
|
} > /usr/local/etc/php/conf.d/farmOS-recommended.ini
|
|
|
|
# Set recommended realpath_cache settings.
|
|
# See https://www.drupal.org/docs/7/managing-site-performance/tuning-phpini-for-drupal
|
|
RUN { \
|
|
echo 'realpath_cache_size=4096K'; \
|
|
echo 'realpath_cache_ttl=3600'; \
|
|
} > /usr/local/etc/php/conf.d/realpath_cache-recommended.ini
|
|
|
|
# Set recommended OPcache for maximum performance in Symfony applications.
|
|
# See https://symfony.com/doc/current/performance.html#configure-opcache-for-maximum-performance
|
|
# @todo
|
|
# Remove this when https://github.com/docker-library/drupal/pull/156 is merged.
|
|
RUN sed -i 's|opcache.memory_consumption=128|opcache.memory_consumption=256|g' /usr/local/etc/php/conf.d/opcache-recommended.ini \
|
|
&& sed -i 's|opcache.max_accelerated_files=4000|opcache.max_accelerated_files=20000|g' /usr/local/etc/php/conf.d/opcache-recommended.ini
|
|
|
|
# Install postgresql-client so Drush can connect to the database.
|
|
RUN apt-get update \
|
|
# See https://stackoverflow.com/questions/51033689/how-to-fix-error-on-postgres-install-ubuntu
|
|
&& mkdir -p /usr/share/man/man1 \
|
|
&& mkdir -p /usr/share/man/man7 \
|
|
&& apt-get install -y postgresql-client
|
|
|
|
# Install git and unzip (needed by Composer).
|
|
RUN apt-get update \
|
|
&& apt-get install -y git unzip
|
|
|
|
# Set the COMPOSER_MEMORY_LIMIT environment variable to unlimited.
|
|
ENV COMPOSER_MEMORY_LIMIT=-1
|
|
|
|
# Add the build-farmOS.sh script.
|
|
COPY build-farmOS.sh /usr/local/bin/
|
|
RUN chmod a+x /usr/local/bin/build-farmOS.sh
|
|
|
|
# Build the farmOS codebase in /var/farmoS with the --no-dev flag.
|
|
# Change the ownership of the sites directory and copy the farmOS codebase into /opt/drupal.
|
|
RUN mkdir /var/farmOS \
|
|
&& /usr/local/bin/build-farmOS.sh --no-dev \
|
|
&& chown -R www-data:www-data /var/farmOS/web/sites \
|
|
&& rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal
|
|
|
|
# Set the entrypoint.
|
|
COPY docker-entrypoint.sh /usr/local/bin/
|
|
RUN chmod u+x /usr/local/bin/docker-entrypoint.sh
|
|
ENTRYPOINT ["docker-entrypoint.sh"]
|
|
CMD ["apache2-foreground"]
|