I’ve stumbled on a few different tutorials on deploying Streamlit to GCP App Engine. One common theme is that the App must be deployed in the flexible (not standard) environment, with a Dockerfile. A couple questions:
Why is a container necessary?
Is there an official Streamlit tutorial for launching the “hello world” streamlit app on App Engine?
I’m not sure a container is actually required, but that it gives you more flexibility. It seems like only Python 3.6 is available in the flexible environment and so if that’s okay with you, you might be able to get away without using Docker.
There isn’t. We’ve put together the Streamlit Deployment Wiki to try and surface the best examples from the community. But with the number of different services where you could deploy a Streamlit app, it would be difficult for us as a company with the current level of staffing to provide detailed instructions for every environment.
it’s easy, but not recommend for stable envs. App Engine spins up a virtual docker host and automatically deploy your Docker container to this env.
In general, the Dockerfile is always named Dockerfile and is placed in the same directory as the corresponding
app.yaml, alternatively you can assign an image URL.
So the only your app code the Docker file, which declares the stack, and an app.yaml is required to trigger a full stack deployment.
Note: Streamlit use WebSockets to create a persistent connection from a client. The open connection allows two-way data exchange between the client and the server at any time, resulting in lower latency and better use of resources.
The App Engine front end forwards incoming requests to the appropriate module on port 8080. You must ensure that your application code monitors port 8080.
# minimum config in order to use Docker
runtime: custom
env: flex
Hi, I recently tried Streamlit deployment to App Engine and wrote an article.
Let me link it here though this topic is already resolved as it has some additional info not written in this thread:
I think it answers all the questions here and also contains some more tips.
Here is a summary. Please read the article for the details.
the App must be deployed in the flexible (not standard) environment, with a Dockerfile
Why is a container necessary?
As Randy (@randyzwitch ) answered, the flexible environment is necessary for WebSockets.
And the flexible environment is container-based, so “container is necessary” in that sense.
However, a custom runtime with original Dockerfile is not necessary. You can use pre-defined Python3 runtime.
Is there an official Streamlit tutorial for launching the “hello world” streamlit app on App Engine?
The article contains a small but complete example though it’s unofficial.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.