Spaces:
Sleeping
Sleeping
| FROM nvcr.io/nvidia/tensorflow:20.12-tf1-py3 | |
| USER root | |
| # Fix GPG Keys and system dependencies | |
| RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub \ | |
| && apt-get update && apt-get install -y libgl1-mesa-glx libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Create user and app directory | |
| RUN useradd -m -u 1000 user | |
| RUN mkdir -p /home/user/app && chown -R user:user /home/user/app | |
| # CRITICAL: Force the path to prioritize NVIDIA's Python 3.7 site-packages over system 3.8 | |
| ENV PYTHONPATH=/usr/local/lib/python3.6/dist-packages:/usr/local/lib/python3.7/dist-packages:/home/user/app | |
| ENV HF_HOME=/home/user/app/.cache | |
| ENV PATH=/home/user/.local/bin:$PATH | |
| WORKDIR /home/user/app | |
| # We use /usr/bin/python3 because in this image it is linked to the TF1.15 build | |
| COPY requirements.txt . | |
| RUN /usr/bin/python3 -m pip install --no-cache-dir --upgrade "pip<23.0" | |
| RUN /usr/bin/python3 -m pip install --no-cache-dir -r requirements.txt | |
| COPY --chown=user:user . . | |
| USER user | |
| # Final Command: Absolute path to ensure we don't hit Python 3.8 | |
| CMD ["/usr/bin/python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |