Hi @mzheng1985 thanks for the question. how did you try to add dependencies into the zip? what are those dependencies/requirements?
Since you are using Azure DevOps for your deployment, you can consider the following options to deploy your Flask app with its dependencies using zip deploy:
- Pre-install Dependencies: You can pre-install the required dependencies in your deployment environment before deploying the Flask app. You can create a custom Docker image or use a pre-built Docker image that already has the required dependencies installed. This approach is similar to the container option, but instead of deploying a container, you can extract the required files from the image and deploy them using zip deploy.
- Include Dependencies in the Zip File: You can include the required dependencies in the zip file along with your Flask app code. This can be done by creating a virtual environment, installing the dependencies in the virtual environment, and including the virtual environment folder in the zip file. When you deploy the zip file, the virtual environment folder will be extracted to the deployment environment, and the Flask app will use the dependencies installed in the virtual environment.
To create a virtual environment and install dependencies, you can use the following commands:
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
To include the virtual environment folder in the zip file, you can use the following command:
zip -r app.zip app.py venv