Copy sites directory instead of packing/unpacking an archive.

This commit is contained in:
Michael Stenta 2019-04-20 22:34:14 -04:00
parent c6de02baec
commit 9c18b4f8e4
2 changed files with 5 additions and 5 deletions

View File

@ -62,9 +62,9 @@ RUN curl -SL "http://ftp.drupal.org/files/projects/farm-${FARMOS_VERSION}-core.t
tar -xvzf /tmp/farm-${FARMOS_VERSION}-core.tar.gz -C /var/www/html/ --strip-components=1 && \
chown -R www-data:www-data /var/www/html
# Create an archive of the sites directory in /tmp/sites.tar.gz, so that it can
# be restored after the volume is mounted via docker-entrypoint.sh.
RUN tar -cvzf /tmp/sites.tar.gz /var/www/html/sites/
# Copy the sites directory to /tmp/sites, so that it can be restored after a
# volume is mounted, if necessary.
RUN cp -rp /var/www/html/sites /tmp/sites
# Mount a volume at /var/www/html/sites.
VOLUME /var/www/html/sites

View File

@ -1,9 +1,9 @@
#!/bin/bash
set -e
# If the sites directory is empty, unpack /tmp/sites.tar.gz.
# If the sites directory is empty, copy from /tmp/sites.
if ! [ "$(ls -A /var/www/html/sites/)" ]; then
tar -xvzf /tmp/sites.tar.gz -C /var/www/html/sites/ --strip-components=4
cp -rp /tmp/sites/. /var/www/html/sites
fi
# Execute the arguments passed into this script.