github-test / Dockerfile
Vatsal Gupta
Use quiet/no-cache flags for uv sync and clean (#300)
d497cda unverified
Raw History Blame Contribute Delete
2.33 kB
# ##########################################################################
# File: Dockerfile
# Author: Vatsal Gupta (gvatsal60)
# Description: Dockerfile for a Streamlit application.
# ##########################################################################
# ##########################################################################
# License
# ##########################################################################
# This Dockerfile is licensed under the Apache 2.0 License.
# License information should be updated as necessary.
# ##########################################################################
# ##########################################################################
# Base Image
# ##########################################################################
FROM ghcr.io/astral-sh/uv:python3.12-trixie-slim
# ##########################################################################
# Maintainer
# ##########################################################################
LABEL maintainer="Vatsal Gupta (gvatsal60)"
# Add non-root user
RUN addgroup --system nonroot \
&& adduser --system --ingroup nonroot nonroot
# ##########################################################################
# Set Working Directory
# ##########################################################################
WORKDIR /app
# Set cache directory to /tmp to avoid permission issues
ENV XDG_CACHE_HOME=/tmp/.cache
# ##########################################################################
# Copy Files
# ##########################################################################
# Copy dependency files first for better caching
COPY pyproject.toml ./
# Install dependencies into a local folder
RUN uv sync --no-cache --quiet
# Copy source code
COPY src/ ./
# ##########################################################################
# Expose Port
# ##########################################################################
EXPOSE 8501
# ##########################################################################
# Command to Run
# ##########################################################################
# Switch to non-root user
USER nonroot
ENTRYPOINT [ "uv", "run", \
"streamlit", "run", "app.py", \
"--server.port=8501", \
"--server.address=0.0.0.0", \
"--browser.gatherUsageStats=false"]