Spaces:
Sleeping
Sleeping
File size: 982 Bytes
436fb0c | 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 | FROM python:3.11-slim
# Prevent Python from writing .pyc files and enable unbuffered output
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
WORKDIR /app
# Install system dependencies required by pyreadstat (needs C compiler)
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc g++ && \
rm -rf /var/lib/apt/lists/*
# Install Python dependencies first (layer caching)
COPY pyproject.toml ./
RUN pip install --no-cache-dir .
# Copy application code
COPY app/ ./app/
COPY templates/ ./templates/
COPY scripts/ ./scripts/
# Create runtime directories and make them writable for non-root user
RUN mkdir -p uploads output audit_logs training_data && \
chmod -R 777 uploads output audit_logs training_data
# HF Spaces requires port 7860
EXPOSE 7860
# HF Spaces runs containers as uid 1000
RUN useradd -m -u 1000 user
USER user
# Run with uvicorn on HF Spaces default port
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|