- Create a source repository in GCP
- Setup a cloud build trigger for the repository in GCP
- Create a Virtual Machine (VM) in GCP under
VM Instances - Clone the repository in VM
- Install docker from the following link
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-18-04 - From here, there are two kinds of deployment we can make
sudo apt updatesudo apt upgradesudo apt-get install build-essential libssl-dev libffi-dev python-devsudo apt-get install python3-venvvenv envsource env/bin/activate- cd in our its
cd streamlit-deployment python3 -m pip install pip==20.3.4 setuptools wheelpip install -r requirements.txtstreamlit run app.py
- sudo docker pull
- In ourcase its,
sudo docker pull gcr.io/imaya-327307/streamlit-deployment:402796a0031dbdd89b37bb5f692e47b3bb819fb5 - If pull command throws an error on invalid credentials, go to GCP Container Registry, in 'Settings' tab change the registry type from "Private" to "Public"
- Upon sucessful pull, run -
sudo docker images - Based on the output from docker images, get the image id and then run
sudo docker run <imageid>
The commands are also given as shell files for easy access
- install-docker.sh
- setup-new-vm.sh