diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..91c7740 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# Inherit from the upsteam farmOS 3.x image. +FROM farmos/farmos:3.x + +# Install `jq` to help in extracting the farmOS version below. +RUN apt-get update && apt-get install -y jq + +# Create a fresh /var/farmOS directory. +RUN rm -r /var/farmOS && mkdir /var/farmOS + +# Copy composer.json and composer.lock into the image. +COPY composer.json /var/farmOS/composer.json +COPY composer.lock /var/farmOS/composer.lock + +# Build the farmOS codebase with Composer as the www-data user in /var/farmOS +# with the --no-dev flag. +RUN (cd /var/farmOS; composer install --no-dev) + +# Set the version in farm.info.yml to match the version locked by Composer. +# This is optional but is useful because the version will appear as the +# "Installation Profile" version at `/admin/reports/status` in farmOS. +RUN sed -i "s|version: 3.x|version: $(jq -r '.packages[] | select(.name == "farmos/farmos").version' /var/farmOS/composer.lock)|g" /var/farmOS/web/profiles/farm/farm.info.yml + +# Copy the farmOS codebase into /opt/drupal. +RUN rm -r /opt/drupal && cp -rp /var/farmOS /opt/drupal