application_directory └Dockerfile └app.py └app.yaml └requirements.txt
Create the following 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
streamlit run app.py
, it is assumed that the application file written in Python is ʻapp.py`.Create the following file.
streamlit
$ pip freeze> requirements.txt
after checking the operation of the application in the virtual environment.app.yaml
runtime: custom
env: flex
Create any project on GCP.
Go to "App Engine" from the navigation menu on the home page of the created project and create an App Engine application. Select "Python" for Language and "Flexible" for Environment.
If you don't have the Google Cloud SDK installed, download and install it. Now you can use the glow command.
Perform the following operations in application_directory.
First, initialize the SDK if necessary.
$gcloud init
Then deploy to App Engine.
$gcloud app deploy
https://stackoverflow.com/questions/59052104/how-do-you-deploy-a-streamlit-app-on-app-engine-gcp
Recommended Posts