Skip to content

paulelvers/streamlit_docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamlit_docker

A slim base repository for a streamlit app in a docker container.

The project structure

├── Dockerfile         <- needed to built the docker image with your app in it.      
├── app
│   ├── app.py         <- this is were your main source code will live.
│
├── requirements.txt   <- here you add all dependencies needed for your app.
├── README.md    
├── LICENSE

The Dockerfile

FROM python:3.7
EXPOSE 8501
WORKDIR /app
COPY requirements.txt ./requirements.txt
RUN pip3 install -r requirements.txt
COPY ./app /app
CMD streamlit run app.py

Quickstart

1. Fork the repository

$ git clone https://github.com/paulelvers/streamlit_docker

2. Navigate into the directory

$ cd streamlit_docker

3. Build the docker image

$ docker build -t streamlit_app:latest .

The . dot tells docker to build from the Dockerfile in your current directory. With -t you will set a tag (a name for the image) and add a version like this name:version

4. Run the image

$ docker run -p 8501:8501 streamlit_app

With -p you map the port of the docker container (8501) to your localhost (8501). and streamlit_app tells the docker run command, which image to run.

5. Visit your app on your local machine

Open your browser and go to http://localhost:8501.

Now you should be able to interact with your app.

Develop yourself

Now you can start developing your own application. Just change the source code in app.py add more python modules and additional dependencies (which you should always add to requirements.txt).

Have a look at the Streamlit Gallery, if you need some inspiration.