Spaces:
Running
Running
File size: 773 Bytes
5d2eba0 d8a5cc9 5d2eba0 d8a5cc9 5d2eba0 4e52e70 5d2eba0 d8a5cc9 5d2eba0 4e52e70 d8a5cc9 5d2eba0 d8a5cc9 4e52e70 5d2eba0 d8a5cc9 5d2eba0 | 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 30 31 32 33 34 35 36 37 | FROM python:3.11-slim
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Create non-root user (required by HF Spaces)
RUN useradd -m -u 1000 user
WORKDIR /app
# Copy and install requirements as root (system-wide)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire application
COPY . .
# Make the app directory writable by user (for SQLite DB, logs, JSON files)
RUN chown -R user:user /app
# Switch to non-root user
USER user
ENV HOME=/home/user \
PATH="/home/user/.local/bin:$PATH" \
PYTHONUNBUFFERED=1
# Expose the port Hugging Face expects
EXPOSE 7860
# Run the orchestration script
CMD ["python", "main.py"]
|