Spaces:
Sleeping
Sleeping
| # Use Python 3.11 as the base image | |
| FROM docker.io/library/python:3.11@sha256:YOUR_PYTHON_3_11_SHA # Replace with the correct SHA for Python 3.11 | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| git-lfs \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| cmake \ | |
| rsync \ | |
| libgl1-mesa-glx \ | |
| && rm -rf /var/lib/apt/lists/* \ | |
| && git lfs install | |
| # Upgrade pip and install Hugging Face specific dependencies | |
| RUN pip install --no-cache-dir pip -U && \ | |
| pip install --no-cache-dir \ | |
| datasets \ | |
| "huggingface-hub>=0.19" \ | |
| "hf_xet>=1.0.0,<2.0.0" \ | |
| "hf-transfer>=0.1.4" \ | |
| "protobuf<4" \ | |
| "click<8.1" \ | |
| "pydantic~=1.0" | |
| # Install fakeroot for apt-get compatibility | |
| RUN apt-get update && apt-get install -y fakeroot && \ | |
| mv /usr/bin/apt-get /usr/bin/.apt-get && \ | |
| echo '#!/usr/bin/env sh\nfakeroot /usr/bin/.apt-get $@' > /usr/bin/apt-get && \ | |
| chmod +x /usr/bin/apt-get && \ | |
| rm -rf /var/lib/apt/lists/* && \ | |
| useradd -m -u 1000 user | |
| # Copy root files (if needed) | |
| COPY --chown=1000:1000 --from=root / / | |
| # Set working directory | |
| WORKDIR /home/user/app | |
| # Install Node.js | |
| RUN apt-get update && \ | |
| apt-get install -y curl && \ | |
| curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \ | |
| apt-get install -y nodejs && \ | |
| rm -rf /var/lib/apt/lists/* && apt-get clean | |
| # Copy requirements.txt and install Python dependencies | |
| COPY --chown=1000:1000 requirements.txt /tmp/requirements.txt | |
| RUN pip install --no-cache-dir -r /tmp/requirements.txt | |
| # Copy application code (adjust as per your repo structure) | |
| COPY --chown=1000:1000 . . | |
| # Command to run the app | |
| CMD ["python", "app.py"] |