FROM python:3.9 # Create a user with a specified UID RUN useradd -m -u 1000 user # Set working directory WORKDIR /app # Copy and install dependencies as root (for permissions) COPY requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir --upgrade -r requirements.txt # Create results directory with proper permissions RUN mkdir -p /app/results && chown -R user:user /app/results # Copy application files COPY --chown=user:user . /app # Switch to the user USER user ENV PATH="/home/user/.local/bin:$PATH" ENV PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python # Expose the port for huggingface spaces EXPOSE 7860 CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]