drupal8-docker/build-rootfs.sh

46 lines
969 B
Bash
Raw Normal View History

2018-11-08 21:17:04 +00:00
#!/bin/bash
set -ex
# Configuration options you usually edit go here
# CONTAINER_WEBROOT=/var/www/html
# This is internal stuff used to build everything
# Be aware, that several of these paths are used with rm -rf!
SRCDIR=$(pwd)/src
TMPDIR=$(pwd)/tmp
BUILDDIR=$(pwd)/build
SCRIPTS_SRC=${SRCDIR}/scripts
ROOTFSTREE=${TMPDIR}/tree
ROOTFSFILE=${BUILDDIR}/rootfs.tar.gz
# WEBROOT_DST=${ROOTFSTREE}${CONTAINER_WEBROOT}
#### Sanitize Build Enviornment
if [ -d ${TMPDIR} ]; then
rm -rf ${TMPDIR}
fi
mkdir ${TMPDIR}
if [ -d ${BUILDDIR} ]; then
rm -rf ${BUILDDIR}
fi
mkdir ${BUILDDIR}
#### Do the work.
#
# ...
#
# Clean up behind us
# if [ "$CLEAN_INTERMEDIATES" = true ]; then
# rm -rf ${ROUNDCUBE_SRC}
# rm -rf ${ISPCONFIG_SRC}
# fi
#### Now we tar everything together, so that the Dockerfile can put everything in place in one run
tar -czf ${ROOTFSFILE} -C ${ROOTFSTREE} .
# Clean up behind us
if [ "$CLEAN_INTERMEDIATES" = true ]; then
rm -rf ${ROOTFSTREE}
fi