This is a simple scaffold project of a Streamlit app with a Docker container.
- Clone the repository:
git clone https://github.com/your-username/streamlit-app-with-docker.git
- Navigate to the project directory:
cd streamlit-app-with-docker
- Build the docker image:
docker compose build
- Run the docker container:
docker compose up
- Your application will be available at http://localhost:8501.
- List the docker containers:
docker ps
- Stop the docker container:
docker compose down
- List the docker images:
docker images
- Remove the docker image:
docker rmi my-streamlit-app
app/
: contains the Streamlit app.Dockerfile
: the dockerfile to build the docker image.docker-compose.yml
: the docker compose file to run the docker container..dockerignore
: the docker ignore file to ignore the files that are not needed to be copied to the docker image.requirements.txt
: the dependencies for the project.README.md
: this file..gitignore
: the git ignore file to ignore the files that are not needed to be committed.
- Create the boilerplate files:
.gitignore
(from github's Python.gitignore: https://github.com/github/gitignore/blob/main/Python.gitignore):curl https://raw.githubusercontent.com/github/gitignore/main/Python.gitignore > .gitignore
requirements.txt
echo streamlit > requirements.txt
README.md
echo "# Streamlit app with Docker" > README.md
app/streamlit_app.py
echo import streamlit as st > app/streamlit_app.py
- Initialize a docker project:
docker init
- Change Dockerfile and docker-compose.yml to your needs.
- Initialize a git repository and add the files:
git init git add . git commit -m "Initial commit"