Spaces:
Running
on
L4
Running
on
L4
Update Dockerfile
Browse files- Dockerfile +8 -5
Dockerfile
CHANGED
|
@@ -4,7 +4,8 @@ FROM continuumio/miniconda3
|
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
|
| 6 |
# 2. Set Environment Variables
|
| 7 |
-
#
|
|
|
|
| 8 |
ENV HOME=/home/user \
|
| 9 |
PATH=/opt/conda/envs/app_env/bin:$PATH \
|
| 10 |
LD_LIBRARY_PATH=/opt/conda/envs/app_env/lib:$LD_LIBRARY_PATH \
|
|
@@ -17,18 +18,20 @@ WORKDIR /home/user/app
|
|
| 17 |
RUN conda create -n app_env python=3.9 wget -y
|
| 18 |
|
| 19 |
# 5. Install Faiss via Conda (Pinned MKL)
|
|
|
|
| 20 |
RUN conda install -n app_env -c pytorch -c nvidia -c conda-forge faiss-gpu=1.7.4 mkl=2021 blas=1.0=mkl -y && \
|
| 21 |
conda clean -ya
|
| 22 |
|
| 23 |
# 6. Install Pip Requirements
|
| 24 |
COPY requirements.txt .
|
|
|
|
| 25 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 26 |
pip install --no-cache-dir -r requirements.txt
|
| 27 |
|
| 28 |
-
# 7. Fix Permissions
|
| 29 |
-
# We
|
| 30 |
-
|
| 31 |
-
|
| 32 |
|
| 33 |
# 8. Switch to User
|
| 34 |
USER user
|
|
|
|
| 4 |
RUN useradd -m -u 1000 user
|
| 5 |
|
| 6 |
# 2. Set Environment Variables
|
| 7 |
+
# We need LD_LIBRARY_PATH for Faiss/MKL.
|
| 8 |
+
# We also set SOLARA_PROXY_CACHE_DIR to be safe.
|
| 9 |
ENV HOME=/home/user \
|
| 10 |
PATH=/opt/conda/envs/app_env/bin:$PATH \
|
| 11 |
LD_LIBRARY_PATH=/opt/conda/envs/app_env/lib:$LD_LIBRARY_PATH \
|
|
|
|
| 18 |
RUN conda create -n app_env python=3.9 wget -y
|
| 19 |
|
| 20 |
# 5. Install Faiss via Conda (Pinned MKL)
|
| 21 |
+
# This handles the "libmkl_intel_lp64.so.1" error
|
| 22 |
RUN conda install -n app_env -c pytorch -c nvidia -c conda-forge faiss-gpu=1.7.4 mkl=2021 blas=1.0=mkl -y && \
|
| 23 |
conda clean -ya
|
| 24 |
|
| 25 |
# 6. Install Pip Requirements
|
| 26 |
COPY requirements.txt .
|
| 27 |
+
# This runs as root and creates a root-owned /home/user/.cache
|
| 28 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 29 |
pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
+
# 7. Fix Permissions (THE FIX)
|
| 32 |
+
# We recursively chown the ENTIRE home directory.
|
| 33 |
+
# This fixes the root-owned .cache folder created by pip in step 6.
|
| 34 |
+
RUN chown -R user:user /home/user
|
| 35 |
|
| 36 |
# 8. Switch to User
|
| 37 |
USER user
|