Spaces:
Sleeping
Sleeping
File size: 1,191 Bytes
4c909c8 f7ba59a 2fbadcc 11c0d05 4c909c8 11c0d05 b683ac4 11c0d05 f7ba59a 1f14759 11c0d05 1f14759 f7ba59a 11c0d05 2fbadcc 1d13a4b 8bcd11d f7ba59a 6896346 2fbadcc f7ba59a 11c0d05 8bcd11d | 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 | 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"] |