Spaces:
Sleeping
Sleeping
| # -------- base image -------- | |
| FROM python:3.10-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| OMP_NUM_THREADS=1 \ | |
| TOKENIZERS_PARALLELISM=false | |
| # ---------- Create Non-Root User ---------- | |
| RUN useradd -m -u 1000 user | |
| # -------- Set working directory -------- | |
| WORKDIR /app | |
| # ---------- Copy requirements and install dependencies first (for better caching) ---------- | |
| COPY --chown=user:user requirements.txt . | |
| RUN pip install -r requirements.txt | |
| # ---------- Copy application files ---------- | |
| COPY --chown=user:user main.py . | |
| COPY --chown=user:user modules/ ./modules/ | |
| COPY --chown=user:user config.cfg . | |
| COPY --chown=user:user product_classification.csv . | |
| # ---------- Copy examples folder explicitly ---------- | |
| COPY --chown=user:user examples/ ./examples/ | |
| # ---------- Ensure proper permissions for examples folder ---------- | |
| RUN chmod -R 755 examples/ | |
| # Switch to non-root user | |
| USER user | |
| # Expose Gradio default port | |
| EXPOSE 7860 | |
| # Launch with unbuffered output | |
| CMD ["python", "main.py"] |