I am aiming to deploy a simple web-app written with Sreamlit, e.g.
app.py
import streamlit as st
st.title('Hello World!')
I can run this on my local machine by running streamlit run app.py
in my command line.
However, I'm not sure how to modify the app.yaml file in GCP's App Engine to deploy this.
Any advice?
You can use App Engine flexible environment for that as you can specify a custom runtime. The steps to follow will be:
Create the Dockerfile:
FROM python:3.7
EXPOSE 8080
WORKDIR /app
COPY requirements.txt ./requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
CMD streamlit run app.py --server.port 8080
I have updated the Dockerfile as App Engine flex requires that the server listens on port 8080.
Create the requirements.txt file with the needed dependencies:
streamlit
Create the app.yaml file:
runtime: custom
env: flex
Both the app.yaml and the Dockerfile must be in the same folder. The above app.yaml settings are very basic, more information can be found in the documentation.
Then to deploy you need to use the following gcloud command:gcloud app deploy
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