init.sh 864 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #! /bin/sh
  2. ls | grep "writefreely.*.tar" &> /dev/null
  3. if [ $? -ne 0 ]; then
  4. echo "could not find a writefreely tarball that fit the grep pattern 'writefreely.*.tar'"
  5. exit 1
  6. fi
  7. echo "Running writefreely bootstrap"
  8. cp writefreely*.tar* bootstrap/
  9. pushd bootstrap
  10. docker build -t writefreely-bootstrap .
  11. docker run -it --rm -v ./data:/data writefreely-bootstrap
  12. if [ $? -ne 0 ]; then # catch errors
  13. exit 1
  14. fi
  15. docker image rm writefreely-bootstrap # cleanup
  16. rm writefreely*.tar* # cleanup
  17. popd
  18. cp writefreely*.tar* production/ # data prep
  19. if [ $? -ne 0 ]; then # catch errors
  20. exit 1
  21. fi
  22. cp bootstrap/data/* production/ # data prep
  23. if [ $? -ne 0 ]; then # catch errors
  24. exit 1
  25. fi
  26. pushd production
  27. docker compose build # generate image
  28. if [ $? -ne 0 ]; then # catch errors
  29. echo "build failed!"
  30. exit 1
  31. fi