GCP App Engine integration

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:

  1. Why is a container necessary?
  2. Is there an official Streamlit tutorial for launching the “hello world” streamlit app on App Engine?

Hi @j_buddy13, welcome to the Streamlit community!

From my reading of the comparison between the two GCP environments, it looks like the flexible environment is needed because Streamlit uses websockets.

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

Deploy: gcloud app deploy ycs-appengine.yaml

1 Like