Skip to content

MoCoMakers/docker_streamlit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DigitalOcean-Docker-Streamlit App.

Simple docker streamlit template app to be run on DigitalOcean app platform.

Initial Setup After Git Clone

After cloning this repository, you need to set up a soft link to the app folder from a sister repository:

  1. Clone the nf_streamlit repository in the same parent directory:

    cd ..
    git clone <nf_streamlit_repo_url> nf_streamlit
    cd docker_streamlit
  2. Create the soft link to point to the app folder:

    ln -s ../nf_streamlit/app/ app
  3. Verify the setup - your directory should look like this:

    ls -la
    # Should show: app -> ../nf_streamlit/app/

The final directory structure should be:

docker_streamlit/
├── .git/
├── .do/
├── Dockerfile
├── LICENSE
├── README.md
├── run_nfstreamlit.sh
└── app -> ../nf_streamlit/app/  (soft link)

Important: The nf_streamlit/app/ directory contains the live data folder and should be mounted as a volume when running the container to ensure the application has access to current data.

To deploy you first need to click on "Use this template" and then simply log into your Digital Ocean account and click on "Apps" -> "Launch Your App" -> "Github" and select the corresponding Github repository.

You can use my referral link to get $100 worth of credit over 60 days.

DigitalOcean Referral Badge

To run locally, try:

# Copy requirements.txt from the soft link (Docker can't follow symlinks during build)
cp app/requirements.txt requirements.txt
# Build the Docker image
docker build . -t streamlit_app
# Run the container with the soft-linked app folder mounted
docker run -p 8501:8501 -v ~/docker_streamlit/app:/app streamlit_app

Production Launch Script

For production deployment, use the included launch script run_nfstreamlit.sh:

# Make the script executable
chmod +x run_nfstreamlit.sh

# Run the container in the background with live data volume
./run_nfstreamlit.sh

This script:

  • Runs the container in the background using nohup
  • Mounts the live data folder from ~/nf_streamlit/app to /app in the container
  • Ensures the application has access to current data files

Tips for the running updates on the server

git fetch origin
git merge --ff origin main
# Copy requirements.txt from the soft link
cp app/requirements.txt requirements.txt
docker build . -t streamlit_app
docker run -p 8501:8501 -v ~/docker_streamlit/app:/app streamlit_app

Important Note for Production Deployment: The Dockerfile automatically installs requirements from the soft-linked app folder during build. For DigitalOcean App Platform deployment, ensure the soft link is properly set up before building, or use the production launch script for local deployment with live data access.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors