thanks! this helped unblock me. For anyone else stumbling onto this thread:
I was able to accomplish App Engine deployment by using a Dockerfile
and this app.yaml
:
runtime: custom
env: flex
instance_class: F2
network:
session_affinity: true
Dockerfile:
FROM python:3.9.3
WORKDIR /app
EXPOSE 8080
COPY requirements.txt ./requirements.txt
RUN pip3 install -r requirements.txt
RUN find /usr/local/lib/python3.9/site-packages/streamlit -type f \( -iname \*.py -o -iname \*.js \) -print0 | xargs -0 sed -i 's/healthz/health-check/g'
COPY main.py ./main.py
CMD streamlit run --server.port 8080 --browser.serverAddress 0.0.0.0 --server.enableCORS False --server.enableXsrfProtection False main.py
/healthz
was an existing endpoint in streamlit that conflicted with GCP’s internal expectations, so I needed to run the sed
one-liner.
Cloud Run seems to work as well, pointed to the image published to the google cloud registry associated with the most recent App Engine build (in the same project), and had it up and running quickly (image didn’t need to be rebuilt).
Digital Ocean Apps deployment worked well (started playing with it while waiting on GCP deployment with the above combo, which was taking much longer once I started using the flex
environment with the Dockerfile…). For Digital Ocean, defaults from dockerhub as the app source worked great. I only needed to configure the health check from default TCP to HTTP at /health-check
and it worked with the same Dockerfile above.