testing / Dockerfile
rdz-falcon's picture
Update Dockerfile
0f292b9 verified
FROM python:3.9-slim
WORKDIR /app
# Create and permission the general application cache directory
RUN mkdir -p /app/.cache_app && \
chown -R 1000:1000 /app/.cache_app && \
chmod -R u+rwx,g+rwx /app/.cache_app
# --- V V V STREAMLIT PERMISSION FIXES V V V ---
# 1. For user-level Streamlit configurations (good practice)
ENV STREAMLIT_HOME=/app/.streamlit_config
RUN mkdir -p ${STREAMLIT_HOME} && \
chown -R 1000:1000 ${STREAMLIT_HOME} && \
chmod -R u+rwx,g+rwx ${STREAMLIT_HOME}
# 2. For the problematic root-level /.streamlit directory (direct fix for the error)
RUN mkdir -p /.streamlit && \
chmod -R 777 /.streamlit
# This creates /.streamlit during build (owned by root) and makes it world-writable.
# --- ^ ^ ^ END OF STREAMLIT PERMISSION FIXES ^ ^ ^ ---
# Set TOKENIZERS_PARALLELISM to false to avoid warnings
ENV TOKENIZERS_PARALLELISM=false
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
cmake \
curl \
software-properties-common \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements file and install Python dependencies
# (Installing requirements before copying all app code improves Docker layer caching)
COPY requirements.txt ./
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy your application source code
COPY src/ ./src/
# Expose the port Streamlit will run on
EXPOSE 8501
# Healthcheck
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
# Entrypoint to run your Streamlit application
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.fileWatcherType", "none"]