Reputation: 1323
I recently started using streamlit
, which is definitely an awesome library for Dashboarding and visualizing Machine Learning applications.
However, my deployment workflow is currently Docker and Heroku. I can't find simple documentation on how to easily deploy a streamlit
app hosted within a Docker container onto Heroku. Therefore, I wanted to document something simple I found here.
Upvotes: 0
Views: 564
Reputation: 1323
After a little bit of research and play around with the code, this is the simplest way that seems to be working:
.streamlit
folder where a config.toml
will liveconfig.toml
write the following code:[browser]
serverAddress = '0.0.0.0'
CMD streamlit run --server.port $PORT app.py
For example, here is my complete Dockerfile based on the code example that streamlit currently provides
FROM continuumio/miniconda3
WORKDIR /home/app
RUN apt-get update
RUN apt-get install nano unzip
RUN apt install curl -y
RUN curl -fsSL https://get.deta.dev/cli.sh | sh
RUN pip install boto3 pandas gunicorn streamlit
COPY . /home/app
CMD streamlit run --server.port $PORT app.py
In development, simply run your container with a PORT
environment variable and a port mapping like this:
docker run -it MY_DOCKER_IMAGE -p HOST_PORT:CONTAINER_PORT -e PORT=CONTAINER_PORT
If everything works correctly locally, then you can follow this tutorial to deploy your container to Heroku :
Upvotes: 2