Merge farmos/farmos:2.x-base Dockerfile into farmos/farmos:2.x.

This commit is contained in:
Michael Stenta 2020-08-12 10:09:35 -04:00
parent 8275315895
commit 07fed82f23
6 changed files with 81 additions and 89 deletions

View File

@ -13,11 +13,9 @@ jobs:
uses: actions/checkout@master
- name: Set FARMOS_VERSION environment variable
run: echo ::set-env name=FARMOS_VERSION::${GITHUB_REF:10}
# This builds the dev Docker image using the specified FARMOS_VERSION,
# This builds the Docker image using the specified FARMOS_VERSION,
# but notably it does NOT override the default PROJECT_VERSION, so the
# farmOS Composer project 2.x branch is always used.
- name: Build farmOS base Docker image
run: docker build -t farmos/farmos:2.x-base docker/base
- name: Build farmOS 2.x Docker image
run: docker build --build-arg FARMOS_REPO=https://github.com/${GITHUB_REPOSITORY} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:2.x docker
- name: Run farmOS Docker container

View File

@ -13,12 +13,12 @@ jobs:
uses: actions/checkout@v2
- name: Set FARMOS_VERSION environment variable
run: echo ::set-env name=FARMOS_VERSION::${GITHUB_REF:11}
- name: Build base Docker image
run: docker build -t farmos/farmos:2.x-base docker/base
- name: Build farmOS 2.x Docker image
run: docker build --build-arg FARMOS_REPO=https://github.com/${GITHUB_REPOSITORY} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:2.x docker
# This builds the dev Docker image using the specified FARMOS_VERSION,
# but notably it does NOT override the default PROJECT_VERSION, so the
# farmOS Composer project 2.x branch is always used.
- name: Build dev Docker image
- name: Build farmOS 2.x-dev Docker image
run: docker build --build-arg FARMOS_REPO=https://github.com/${GITHUB_REPOSITORY} --build-arg FARMOS_VERSION=${FARMOS_VERSION} -t farmos/farmos:2.x-dev docker/dev
- name: Create docker-compose.yml
run: curl https://raw.githubusercontent.com/farmOS/farmOS/2.x/docker/docker-compose.development.yml -o docker-compose.yml

View File

@ -1,5 +1,5 @@
# Inherit from the farmOS 2.x base image.
FROM farmos/farmos:2.x-base
# Inherit from the Drupal 9 image on Docker Hub.
FROM drupal:9
# Set the farmOS and composer project repository URLs and versions.
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git
@ -7,6 +7,73 @@ ARG FARMOS_VERSION=2.x
ARG PROJECT_REPO=https://github.com/farmOS/composer-project.git
ARG PROJECT_VERSION=2.x
# Install the BCMath PHP extension.
RUN docker-php-ext-install bcmath
# Build and install the Uploadprogress PHP extension.
# See http://git.php.net/?p=pecl/php/uploadprogress.git
RUN curl -fsSL 'https://git.php.net/?p=pecl/php/uploadprogress.git;a=snapshot;h=be300078bbd457d341753a9fa7edf6b4a95c9765;sf=tgz' -o php-uploadprogress.tar.gz \
&& tar -xzf php-uploadprogress.tar.gz \
&& rm php-uploadprogress.tar.gz \
&& ( \
cd uploadprogress-be30007 \
&& phpize \
&& ./configure --enable-uploadprogress \
&& make \
&& make install \
) \
&& rm -r uploadprogress-be30007 \
&& docker-php-ext-enable uploadprogress
# 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 \
&& ./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'; \
} > /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
# 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
# Create a directory for the farmOS codebase.
RUN mkdir /var/farmOS && chown www-data:www-data /var/farmOS
# Switch to the /var/farmOS directory as the www-data user.
WORKDIR /var/farmOS
USER www-data
@ -29,3 +96,9 @@ USER root
# Copy /var/farmOS to /opt/drupal.
RUN 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"]

View File

@ -1,79 +0,0 @@
# This creates a base image that is used by both the default farmOS image and
# the farmOS development image. This base image is not intended to be run by
# itself. It simply builds an image with all of farmOS's dependencies.
# Inherit from the Drupal 9 image on Docker Hub.
FROM drupal:9
# Install git and unzip (needed by Composer).
RUN apt-get update -y \
&& apt-get install -y git unzip
# Set the COMPOSER_MEMORY_LIMIT environment variable to unlimited.
ENV COMPOSER_MEMORY_LIMIT=-1
# Install the BCMath PHP extension.
RUN docker-php-ext-install bcmath
# Build and install the Uploadprogress PHP extension.
# See http://git.php.net/?p=pecl/php/uploadprogress.git
RUN curl -fsSL 'https://git.php.net/?p=pecl/php/uploadprogress.git;a=snapshot;h=be300078bbd457d341753a9fa7edf6b4a95c9765;sf=tgz' -o php-uploadprogress.tar.gz \
&& tar -xzf php-uploadprogress.tar.gz \
&& rm php-uploadprogress.tar.gz \
&& ( \
cd uploadprogress-be30007 \
&& phpize \
&& ./configure --enable-uploadprogress \
&& make \
&& make install \
) \
&& rm -r uploadprogress-be30007
RUN docker-php-ext-enable uploadprogress
# 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
RUN 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 \
&& ./autogen.sh \
&& ./configure \
&& make \
&& make install \
) \
&& rm -r php-geos
RUN 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'; \
} > /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
# 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
# Create a directory for the farmOS codebase.
RUN mkdir /var/farmOS && chown www-data:www-data /var/farmOS
# 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"]

View File

@ -1,5 +1,5 @@
# Inherit from the farmOS 2.x base image.
FROM farmos/farmos:2.x-base
# Inherit from the farmOS 2.x image.
FROM farmos/farmos:2.x
# Set the farmOS and composer project repository URLs and versions.
ARG FARMOS_REPO=https://github.com/farmOS/farmOS.git