#! /bin/sh ls | grep "writefreely.*.tar" &> /dev/null if [ $? -ne 0 ]; then echo "could not find a writefreely tarball that fit the grep pattern 'writefreely.*.tar'" exit 1 fi echo "Running writefreely bootstrap" cp writefreely*.tar* bootstrap/ pushd bootstrap docker build -t writefreely-bootstrap . docker run -it --rm -v ./data:/data writefreely-bootstrap if [ $? -ne 0 ]; then # catch errors exit 1 fi docker image rm writefreely-bootstrap # cleanup rm writefreely*.tar* # cleanup popd cp writefreely*.tar* production/ # data prep if [ $? -ne 0 ]; then # catch errors exit 1 fi cp bootstrap/data/* production/ # data prep if [ $? -ne 0 ]; then # catch errors exit 1 fi pushd production docker compose build # generate image if [ $? -ne 0 ]; then # catch errors echo "build failed!" exit 1 fi