I am deploying a web app using the Python-Django framework to Microsoft Azure.
I have succeeded in deploying it, but every time I deploy, I have to open the Azure SSH tool
and run the command apt-get install libgtk2.0-dev
which I gather is some Linux dependency for the opencv-python image processing library.
I wonder if there is a way to install the required software using deploy.sh
files.
deploy.sh
echo "Running Linux Deployment Script..."
apt-get update && apt install -y libxrender1 libxext6
apt-get install -y libfontconfig1
apt-get install libgtk2.0-dev
Thanks in advance for your help.
You can create a script to install libgtk2.0-dev, say test.sh under /home/site. And then add an app setting under 'Configuration' called PRE_BUILD_SCRIPT_PATH with /home/site/test.sh as the value.
You can run a script on every Webapp startup. Just adjust your script as described here: https://stackoverflow.com/a/69923647/2606766
Create a start.sh file, e.g. like this:
# install package & start app
apt-get update -y
apt install -y libxrender1 libxext6
apt-get install -y libfontconfig1
apt-get install libgtk2.0-dev
# don't forget to start your webapp service at the end of this script, e.g.:
python manage.py runserver
Set it as your startup script:
Note: There are two pitfalls to this approach:
chmod 755 start.sh
or use a git command (see SO).If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With