- Install required dependencies on local:
pip install -r requirements.txt
- Test the streamlit app on local:
streamlit run app.py
(Note: Run as administrator on Windows and remove "sudo" in commands)
- Important - Make sure you have installed Docker on your PC:
- Linux: Docker
- Windows/Mac: Docker Desktop
- Start Docker:
- Linux (Home Directory):
sudo systemctl start docker - Windows: You can start Docker engine from Docker Desktop.
- Build Docker image from the project directory:
sudo docker build -t Image_name:tag .
(Note: Rerun the Docker build command if you want to make any changes to the code files and redeploy.)
- witch to Home Directory:
cd ~
List the built Docker images
$ sudo docker images
- Start a container:
sudo docker run -p 80:80 Image_ID
-
This will display the URL to access the Streamlit app (http://0.0.0.0:80). Note that this URL may not work on Windows. For Windows, go to http://localhost/.
-
In a different terminal window, you can check the running containers with:
sudo docker ps
- Stop the container:
- Use
ctrl + cor stop it from Docker Desktop.
- Check all containers:
sudo docker ps -a
- Delete the container if you are not going to run this again:
sudo docker container prune
-
Sign up on Docker Hub.
-
Create a repository on Docker Hub.
-
Log in to Docker Hub from the terminal. You can log in with your password or access token.
sudo docker login
- Tag your local Docker image to the Docker Hub repository:
sudo docker tag Image_ID username/repo-name:tag
- Push the local Docker image to the Docker Hub repository:
sudo docker push username/repo-name:tag
(If you want to delete the image, you can delete the repository in Docker Hub and force delete it locally.)
- Command to force delete an image (but don't do this yet):
$ sudo docker rmi -f IMAGE_ID