FROM python:3.10-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Create a non-root user and home directory RUN useradd -m -s /bin/bash streamlit_user # Set working directory WORKDIR /home/streamlit_user/app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ curl \ libgl1-mesa-glx \ && rm -rf /var/lib/apt/lists/* # Create model weights directory and assign ownership RUN mkdir -p /home/streamlit_user/step1x_weights && \ chown -R streamlit_user:streamlit_user /home/streamlit_user # Copy requirements and install Python dependencies COPY requirements.txt ./requirements.txt RUN pip install --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy app source code COPY src/ ./src/ # Change user to non-root USER streamlit_user # Expose Streamlit port EXPOSE 8501 # Environment settings for Streamlit ENV STREAMLIT_SERVER_HEADLESS=true # Run the app ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]