51 lines
2.2 KiB
Docker
51 lines
2.2 KiB
Docker
# Inherit from the farmOS 7.x-1.x image.
|
|
FROM farmos/farmos:7.x-1.x
|
|
|
|
# Set the farmOS repository URL.
|
|
ARG FARMOS_REPO=https://git.drupal.org/project/farm.git
|
|
|
|
# Set the farmOS branch to git clone.
|
|
ARG FARMOS_BRANCH=7.x-1.x
|
|
|
|
# Change the user/group IDs of www-data inside the image to match the ID of the
|
|
# developer's user on the host machine. This allows Composer to create files
|
|
# owned by www-data inside the container, while keeping those files editable by
|
|
# the developer outside of the container.
|
|
# This defaults to 1000, based on the assumption that the developer is running
|
|
# 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
|
|
|
|
# Install Xdebug.
|
|
RUN yes | pecl install xdebug-2.9.8 \
|
|
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
|
|
&& echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
|
|
&& echo "xdebug.remote_autostart=off" >> /usr/local/etc/php/conf.d/xdebug.ini
|
|
|
|
# Install git and unzip for use by Drush Make.
|
|
RUN apt-get update && apt-get install -y git unzip
|
|
|
|
# Install Drush 8 with the phar file.
|
|
ENV DRUSH_VERSION 8.3.5
|
|
RUN curl -fsSL -o /usr/local/bin/drush.phar "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" \
|
|
&& chmod +x /usr/local/bin/drush.phar \
|
|
&& ln -s /usr/local/bin/drush.phar /usr/local/bin/drush \
|
|
&& drush core-status
|
|
|
|
# Install mariadb-client so Drush can connect to the database.
|
|
RUN apt-get update && apt-get install -y mariadb-client
|
|
|
|
# Build the farmOS repository in /tmp/farmOS.
|
|
RUN git clone --branch ${FARMOS_BRANCH} ${FARMOS_REPO} /tmp/farmOS && \
|
|
sed -i 's@http://git.drupal.org/project/farm.git@'"${FARMOS_REPO}"'@g' /tmp/farmOS/build-farm.make && \
|
|
sed -i 's/7.x-1.x/'"${FARMOS_BRANCH}"'/g' /tmp/farmOS/build-farm.make && \
|
|
drush make --working-copy --no-gitinfofile /tmp/farmOS/build-farm.make /tmp/www && \
|
|
chown -R www-data:www-data /tmp/www
|
|
|
|
# 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"]
|