diff --git a/.gitignore b/.gitignore index 131840b7b6cac702b0b5138ba679ee3de58efb89..4356310f89054fdbdd022499f08f7728caf19050 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,5 @@ coverage *.sw? __pycache__/ -env/ \ No newline at end of file +env/ +archive.zip diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000000000000000000000000000000000000..baa69e92a5f9aff2dd4ddd05dad364a335997a36 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,48 @@ +#!/bin/bash -ex + +# Check if npm is installed +if ! hash npm 2>/dev/null; then + echo "Error: npm is not installed." + exit 1 +fi + +# Check if zip is installed +if ! hash zip 2>/dev/null; then + echo "Error: zip is not installed." + exit 1 +fi + +# Remove 'dist' and 'node_modules' directories if they exist +echo "Cleaning up old 'dist' and 'node_modules' directories..." +rm -rf dist node_modules + +# Run npm install +echo "Running npm install..." +npm ci + +# Run npm build +echo "Running npm run build..." +npm run build + +# Check if the build was successful and 'dist' directory exists +if [ ! -d "dist" ]; then + echo "Error: 'dist' directory not found. Build may have failed." + exit 1 +fi + +# Check if 'requirements.txt' exists +if [ ! -f "requirements.txt" ]; then + echo "Error: 'requirements.txt' file not found." + exit 1 +fi + +# Check if 'app.py' exists +if [ ! -f "app.py" ]; then + echo "Error: 'app.py' file not found." + exit 1 +fi + +# Create a zip file +zip -r archive.zip requirements.txt app.py dist + +echo "Archive 'archive.zip' created successfully."