From c353068bf4f388327a921a4465c937cdc6fdac1f Mon Sep 17 00:00:00 2001 From: Michael Stenta Date: Sat, 20 Apr 2019 17:25:29 -0400 Subject: [PATCH] Provide a development Dockerfile that extends the base farmOS image. --- docker/dev/Dockerfile | 28 +++++++++++++++++++++++++++ docker/dev/docker-entrypoint.sh | 11 +++++++++++ docker/docker-compose.development.yml | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 docker/dev/Dockerfile create mode 100644 docker/dev/docker-entrypoint.sh diff --git a/docker/dev/Dockerfile b/docker/dev/Dockerfile new file mode 100644 index 000000000..7da81e1ad --- /dev/null +++ b/docker/dev/Dockerfile @@ -0,0 +1,28 @@ +# Inherit from the farmOS 7.x-1.x image. +FROM farmos/farmos:7.x-1.x + +# Set the farmOS version to the development branch. +ENV FARMOS_VERSION 7.x-1.x + +# 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.2.1 +RUN curl -fsSL -o /usr/local/bin/drush "https://github.com/drush-ops/drush/releases/download/${DRUSH_VERSION}/drush.phar" && \ + chmod +x /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_VERSION} https://git.drupal.org/project/farm.git /tmp/farmOS && \ + 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"] diff --git a/docker/dev/docker-entrypoint.sh b/docker/dev/docker-entrypoint.sh new file mode 100644 index 000000000..0228d1088 --- /dev/null +++ b/docker/dev/docker-entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +# If the webroot directory is empty, copy from /tmp/www. +if ! [ "$(ls -A /var/www/html/)" ]; then + cp -rp /tmp/www/. /var/www/html +fi + +# Execute the arguments passed into this script. +echo "Attempting: $@" +exec "$@" diff --git a/docker/docker-compose.development.yml b/docker/docker-compose.development.yml index d6860a507..03d6c531b 100644 --- a/docker/docker-compose.development.yml +++ b/docker/docker-compose.development.yml @@ -15,7 +15,7 @@ services: www: depends_on: - db - image: farmos/farmos:7.x-1.x + image: farmos/farmos:dev volumes: - './www:/var/www/html' ports: