Spaces:
Paused
Paused
user fixes?
Browse files- Dockerfile +12 -9
Dockerfile
CHANGED
|
@@ -1,35 +1,38 @@
|
|
| 1 |
FROM pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel
|
| 2 |
|
| 3 |
-
RUN apt update && apt install -y \
|
| 4 |
git fish tmux curl ffmpeg \
|
| 5 |
libgl1-mesa-glx libglib2.0-0 \
|
| 6 |
-
build-essential ninja-build python3.10-venv
|
| 7 |
-
|
| 8 |
-
|
|
|
|
| 9 |
RUN useradd -m -u 1000 user
|
| 10 |
-
USER user
|
| 11 |
-
WORKDIR /home/user
|
| 12 |
|
| 13 |
# Create HF cache with correct ownership
|
| 14 |
ENV HF_HOME=/home/user/.cache/huggingface
|
| 15 |
-
RUN mkdir -p $HF_HOME
|
| 16 |
|
| 17 |
# Thread settings
|
| 18 |
ENV OMP_NUM_THREADS=1
|
| 19 |
ENV MKL_NUM_THREADS=1
|
| 20 |
ENV NUMEXPR_NUM_THREADS=1
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Create virtualenv
|
| 23 |
RUN python3 -m venv /home/user/venv
|
| 24 |
ENV PATH="/home/user/venv/bin:$PATH"
|
| 25 |
|
| 26 |
# Dependencies
|
| 27 |
-
COPY --chown=user requirements.txt .
|
| 28 |
RUN pip install --upgrade pip && \
|
| 29 |
pip install --no-cache-dir -r requirements.txt
|
| 30 |
|
| 31 |
# Copy app
|
| 32 |
-
COPY --chown=user . .
|
| 33 |
|
| 34 |
EXPOSE 7860
|
| 35 |
CMD ["python3", "app.py"]
|
|
|
|
| 1 |
FROM pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel
|
| 2 |
|
| 3 |
+
RUN apt-get update && apt-get install -y \
|
| 4 |
git fish tmux curl ffmpeg \
|
| 5 |
libgl1-mesa-glx libglib2.0-0 \
|
| 6 |
+
build-essential ninja-build python3.10-venv \
|
| 7 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
+
|
| 9 |
+
# Create non-root user
|
| 10 |
RUN useradd -m -u 1000 user
|
|
|
|
|
|
|
| 11 |
|
| 12 |
# Create HF cache with correct ownership
|
| 13 |
ENV HF_HOME=/home/user/.cache/huggingface
|
| 14 |
+
RUN mkdir -p $HF_HOME && chown -R user:user /home/user
|
| 15 |
|
| 16 |
# Thread settings
|
| 17 |
ENV OMP_NUM_THREADS=1
|
| 18 |
ENV MKL_NUM_THREADS=1
|
| 19 |
ENV NUMEXPR_NUM_THREADS=1
|
| 20 |
|
| 21 |
+
# Switch to user before creating venv
|
| 22 |
+
USER user
|
| 23 |
+
WORKDIR /home/user/app
|
| 24 |
+
|
| 25 |
# Create virtualenv
|
| 26 |
RUN python3 -m venv /home/user/venv
|
| 27 |
ENV PATH="/home/user/venv/bin:$PATH"
|
| 28 |
|
| 29 |
# Dependencies
|
| 30 |
+
COPY --chown=user:user requirements.txt .
|
| 31 |
RUN pip install --upgrade pip && \
|
| 32 |
pip install --no-cache-dir -r requirements.txt
|
| 33 |
|
| 34 |
# Copy app
|
| 35 |
+
COPY --chown=user:user . .
|
| 36 |
|
| 37 |
EXPOSE 7860
|
| 38 |
CMD ["python3", "app.py"]
|