Hint: It's not Streamlit Cloud
Nice article. I think Hugging Face is also a great option for deployment as it doesn't cost you. Once dockized we can just deployment in Hugging Face.
I hadn’t even considered hugging face, thanks for the recommendation!
You definitely need to try. I tried hugging face deployment when I faced memory issues with GitHub and was not able to deploy streamlit online. Solution was to upload the dataset and model to hugging face and then deploy streamlit on hugging face.
Since many have shifted from PIP to UV. Below is the minimal Dockerfile template
FROM python:3.11-bullseye
WORKDIR /app
# Install uv
RUN pip install --no-cache-dir uv
# Copy dependency files first
COPY pyproject.toml uv.lock ./
# Install dependencies (creates .venv)
RUN uv sync --frozen
# Ensure venv binaries are used
ENV PATH="/app/.venv/bin:$PATH"
# Copy application code
COPY . .
#Expose the port for streamlit users
EXPOSE 8501
# Run streamlit app
CMD ["streamlit", "run", "app.py", "--host", "0.0.0.0", "--port", "8501"]
Nice piece
Nice article. I think Hugging Face is also a great option for deployment as it doesn't cost you. Once dockized we can just deployment in Hugging Face.
I hadn’t even considered hugging face, thanks for the recommendation!
You definitely need to try. I tried hugging face deployment when I faced memory issues with GitHub and was not able to deploy streamlit online. Solution was to upload the dataset and model to hugging face and then deploy streamlit on hugging face.
Since many have shifted from PIP to UV. Below is the minimal Dockerfile template
FROM python:3.11-bullseye
WORKDIR /app
# Install uv
RUN pip install --no-cache-dir uv
# Copy dependency files first
COPY pyproject.toml uv.lock ./
# Install dependencies (creates .venv)
RUN uv sync --frozen
# Ensure venv binaries are used
ENV PATH="/app/.venv/bin:$PATH"
# Copy application code
COPY . .
#Expose the port for streamlit users
EXPOSE 8501
# Run streamlit app
CMD ["streamlit", "run", "app.py", "--host", "0.0.0.0", "--port", "8501"]
Nice piece