Spaces:
Runtime error
Runtime error
Jinglong Xiong
commited on
Commit
·
38b96e9
1
Parent(s):
8ab6e21
fix permission
Browse files- Dockerfile +14 -23
Dockerfile
CHANGED
|
@@ -1,19 +1,17 @@
|
|
| 1 |
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Set environment variables
|
| 4 |
ENV PYTHONUNBUFFERED=1 \
|
| 5 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
-
DEBIAN_FRONTEND=noninteractive
|
| 7 |
-
# Set cache directories to locations with write permissions
|
| 8 |
-
KAGGLE_CONFIG_DIR=/app/.cache/kaggle \
|
| 9 |
-
KAGGLEHUB_CACHE_FOLDER=/app/.cache/kagglehub \
|
| 10 |
-
MPLCONFIGDIR=/app/.cache/matplotlib \
|
| 11 |
-
TRANSFORMERS_CACHE=/app/.cache/transformers \
|
| 12 |
-
HF_HOME=/app/.cache/huggingface \
|
| 13 |
-
XDG_CACHE_HOME=/app/.cache \
|
| 14 |
-
HOME=/app
|
| 15 |
-
|
| 16 |
-
WORKDIR /app
|
| 17 |
|
| 18 |
# Install system dependencies
|
| 19 |
RUN apt-get update && apt-get install -y \
|
|
@@ -30,14 +28,10 @@ RUN apt-get update && apt-get install -y \
|
|
| 30 |
libxrender1 \
|
| 31 |
libxext6 \
|
| 32 |
ffmpeg \
|
| 33 |
-
curl \
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
-
# Create a non-root user to run our application
|
| 37 |
-
RUN groupadd -r appuser && useradd -r -g appuser -m -d /app appuser
|
| 38 |
-
|
| 39 |
# Copy requirements first to leverage Docker cache
|
| 40 |
-
COPY requirements.txt
|
| 41 |
|
| 42 |
# Install Python dependencies
|
| 43 |
RUN pip install --no-cache-dir --upgrade pip && \
|
|
@@ -46,19 +40,16 @@ RUN pip install --no-cache-dir --upgrade pip && \
|
|
| 46 |
pip install --no-cache-dir git+https://github.com/openai/CLIP.git
|
| 47 |
|
| 48 |
# Copy the whole application
|
| 49 |
-
COPY .
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
# Set environment variables for GPU usage
|
| 56 |
ENV NVIDIA_VISIBLE_DEVICES=all \
|
| 57 |
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
| 58 |
|
| 59 |
-
# Switch to non-root user
|
| 60 |
-
USER appuser
|
| 61 |
-
|
| 62 |
# Expose port for Streamlit
|
| 63 |
EXPOSE 8501
|
| 64 |
|
|
|
|
| 1 |
FROM nvidia/cuda:12.1.1-devel-ubuntu22.04
|
| 2 |
|
| 3 |
+
RUN useradd -m -u 1000 user
|
| 4 |
+
USER user
|
| 5 |
+
|
| 6 |
+
ENV HOME=/home/user \
|
| 7 |
+
PATH=/home/user/.local/bin:$PATH
|
| 8 |
+
|
| 9 |
+
WORKDIR $HOME/app
|
| 10 |
+
|
| 11 |
# Set environment variables
|
| 12 |
ENV PYTHONUNBUFFERED=1 \
|
| 13 |
PYTHONDONTWRITEBYTECODE=1 \
|
| 14 |
+
DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
# Install system dependencies
|
| 17 |
RUN apt-get update && apt-get install -y \
|
|
|
|
| 28 |
libxrender1 \
|
| 29 |
libxext6 \
|
| 30 |
ffmpeg \
|
|
|
|
| 31 |
&& rm -rf /var/lib/apt/lists/*
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
# Copy requirements first to leverage Docker cache
|
| 34 |
+
COPY --chown=user requirements.txt $HOME/app
|
| 35 |
|
| 36 |
# Install Python dependencies
|
| 37 |
RUN pip install --no-cache-dir --upgrade pip && \
|
|
|
|
| 40 |
pip install --no-cache-dir git+https://github.com/openai/CLIP.git
|
| 41 |
|
| 42 |
# Copy the whole application
|
| 43 |
+
COPY --chown=user . $HOME/app
|
| 44 |
|
| 45 |
+
# Install and build star-vector if it exists
|
| 46 |
+
# COPY star-vector/ ./star-vector/
|
| 47 |
+
# RUN if [ -d "star-vector" ]; then cd star-vector && pip install -e . && cd ..; fi
|
| 48 |
|
| 49 |
# Set environment variables for GPU usage
|
| 50 |
ENV NVIDIA_VISIBLE_DEVICES=all \
|
| 51 |
NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
| 52 |
|
|
|
|
|
|
|
|
|
|
| 53 |
# Expose port for Streamlit
|
| 54 |
EXPOSE 8501
|
| 55 |
|