3
0
Fork 0
mirror of https://github.com/farmOS/farmOS.git synced 2024-02-23 11:37:38 +01:00

Build farmOS in /var/farmOS instead of /var/www/farmOS.

This commit is contained in:
Michael Stenta 2020-08-08 18:14:13 -04:00
parent f3a7e88529
commit 26c004d6a1
4 changed files with 15 additions and 14 deletions

View file

@ -13,7 +13,7 @@ FROM farmos/farmos:2.x-dev as build
FROM farmos/farmos:2.x-base
# Copy prebuilt codebase into the container.
# We copy both /var/www/farmOS and /var/www/html so that docker-entrypoint.sh
# We copy both /var/farmOS and /var/www/html so that docker-entrypoint.sh
# can replace files in mounted volumes as necessary.
COPY --from=build /var/www/farmOS/ /var/www/farmOS/
COPY --from=build /var/farmOS/ /var/farmOS/
COPY --from=build /var/www/html/ /var/www/html/

View file

@ -63,7 +63,7 @@ RUN apt-get update \
&& apt-get install -y postgresql-client
# Create a directory for the farmOS codebase.
RUN mkdir /var/www/farmOS && chown www-data:www-data /var/www/farmOS
RUN mkdir /var/farmOS && chown www-data:www-data /var/farmOS
# Configure Apache to use /var/www/html/web as the document root.
ENV APACHE_DOCUMENT_ROOT=/var/www/html/web

View file

@ -4,19 +4,19 @@ set -e
###
# This entrypoint script will check to see if certain directories were mounted
# as volumes (and are therefore empty), and will copy files from the pre-built
# farmOS codebase in /var/www/farmOS to populate them.
# farmOS codebase in /var/farmOS to populate them.
###
# If the /var/www/html directory is empty, copy from /var/www/farmOS.
# If the /var/www/html directory is empty, copy from /var/farmOS.
if ! [ "$(ls -A /var/www/html/)" ]; then
echo "farmOS codebase not detected. Copying from pre-built files in the Docker image."
cp -rp /var/www/farmOS/. /var/www/html
cp -rp /var/farmOS/. /var/www/html
fi
# If the sites directory is empty, copy from /var/www/farmOS/web/sites.
# If the sites directory is empty, copy from /var/farmOS/web/sites.
if ! [ "$(ls -A /var/www/html/web/sites/)" ]; then
echo "farmOS sites directory not detected. Copying from pre-built files in the Docker image."
cp -rp /var/www/farmOS/web/sites/. /var/www/html/web/sites
cp -rp /var/farmOS/web/sites/. /var/www/html/web/sites
fi
# Execute the arguments passed into this script.

View file

@ -15,7 +15,8 @@ ARG PROJECT_VERSION=2.x
# as UID 1000 on the host machine. It can be overridden at image build time with:
# --build-arg WWW_DATA_ID=$(id -u)
ARG WWW_DATA_ID=1000
RUN usermod -u ${WWW_DATA_ID} www-data && groupmod -g ${WWW_DATA_ID} www-data
RUN usermod -u ${WWW_DATA_ID} www-data && groupmod -g ${WWW_DATA_ID} www-data \
&& chown www-data:www-data /var/farmOS
# Install git and unzip (needed by Composer).
RUN apt-get update -y \
@ -28,8 +29,8 @@ RUN curl -sS https://getcomposer.org/installer | \
# Create a Composer config directory for the www-data user.
RUN mkdir /var/www/.composer && chown www-data:www-data /var/www/.composer
# Switch to the /var/www/farmOS directory as the www-data user.
WORKDIR /var/www/farmOS
# Switch to the /var/farmOS directory as the www-data user.
WORKDIR /var/farmOS
USER www-data
# Set the COMPOSER_MEMORY_LIMIT environment variable to unlimited.
@ -51,14 +52,14 @@ RUN cp web/core/phpunit.xml.dist phpunit.xml \
&& sed -i 's|name="BROWSERTEST_OUTPUT_DIRECTORY" value=""|name="BROWSERTEST_OUTPUT_DIRECTORY" value="/var/www/html/web/sites/simpletest/browser_output"|g' phpunit.xml \
&& sed -i 's|\./|\./web/core/|g' phpunit.xml \
&& sed -i 's|\.\./web/core/|\./web/|g' phpunit.xml \
&& mkdir -p /var/www/farmOS/web/sites/simpletest/browser_output
&& mkdir -p /var/farmOS/web/sites/simpletest/browser_output
# Switch back to the /var/www/html directory as the root user.
WORKDIR /var/www/html
USER root
# Copy /var/www/farmOS to /var/www/html.
RUN rm -r /var/www/html && cp -r /var/www/farmOS /var/www/html
# Copy /var/farmOS to /var/www/html.
RUN rm -r /var/www/html && cp -r /var/farmOS /var/www/html
# Install and configure XDebug.
RUN yes | pecl install xdebug \