init.sh 921 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. if [ $? -ne 0 ]; then # catch errors
  12. exit 1
  13. fi
  14. docker run -it --rm -v ./data:/data writefreely-bootstrap
  15. if [ $? -ne 0 ]; then # catch errors
  16. exit 1
  17. fi
  18. docker image rm writefreely-bootstrap # cleanup
  19. rm writefreely*.tar* # cleanup
  20. popd
  21. cp writefreely*.tar* production/ # data prep
  22. if [ $? -ne 0 ]; then # catch errors
  23. exit 1
  24. fi
  25. cp bootstrap/data/* production/ # data prep
  26. if [ $? -ne 0 ]; then # catch errors
  27. exit 1
  28. fi
  29. pushd production
  30. docker compose build # generate image
  31. if [ $? -ne 0 ]; then # catch errors
  32. echo "build failed!"
  33. exit 1
  34. fi