File size: 759 Bytes
7e85729 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 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"]
|