Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +20 -14
Dockerfile
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
-
# Use the official
|
2 |
-
FROM
|
|
|
|
|
|
|
|
|
3 |
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
@@ -7,27 +11,29 @@ WORKDIR /app
|
|
7 |
# Create a non-root user
|
8 |
RUN useradd -m appuser
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
# Create writable directories for Hugging Face and Triton cache
|
11 |
RUN mkdir -p /workspace/huggingface_cache /home/appuser/.triton && \
|
12 |
chmod -R 777 /workspace/huggingface_cache /home/appuser/.triton
|
13 |
|
14 |
-
# Set environment variables
|
15 |
ENV HF_HOME=/workspace/huggingface_cache
|
16 |
ENV TRITON_CACHE_DIR=/home/appuser/.triton
|
17 |
|
18 |
-
# Install system dependencies
|
19 |
-
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
|
20 |
-
|
21 |
# Set umask to ensure proper file permissions
|
22 |
RUN umask 002
|
23 |
|
24 |
-
# Copy the
|
25 |
-
COPY requirements.txt requirements.txt
|
26 |
-
|
27 |
-
# Install required packages
|
28 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
29 |
-
|
30 |
-
# Copy the rest of the application code
|
31 |
COPY . .
|
32 |
|
33 |
# Change ownership to non-root user
|
@@ -40,4 +46,4 @@ USER appuser
|
|
40 |
EXPOSE 7860
|
41 |
|
42 |
# Run the application
|
43 |
-
CMD ["
|
|
|
1 |
+
# Use the official NVIDIA CUDA image
|
2 |
+
FROM nvidia/cuda:12.5.1-cudnn-devel-ubuntu20.04
|
3 |
+
|
4 |
+
# Set environment variables for non-interactive installation and timezone
|
5 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
6 |
+
TZ=Europe/Paris
|
7 |
|
8 |
# Set the working directory
|
9 |
WORKDIR /app
|
|
|
11 |
# Create a non-root user
|
12 |
RUN useradd -m appuser
|
13 |
|
14 |
+
# Install system dependencies and Python
|
15 |
+
RUN apt-get update && apt-get install -y \
|
16 |
+
python3-pip \
|
17 |
+
python3-dev \
|
18 |
+
git \
|
19 |
+
&& rm -rf /var/lib/apt/lists/*
|
20 |
+
|
21 |
+
# Install any necessary Python packages (e.g., Flask, transformers, torch, etc.)
|
22 |
+
COPY requirements.txt requirements.txt
|
23 |
+
RUN pip3 install --no-cache-dir -r requirements.txt
|
24 |
+
|
25 |
# Create writable directories for Hugging Face and Triton cache
|
26 |
RUN mkdir -p /workspace/huggingface_cache /home/appuser/.triton && \
|
27 |
chmod -R 777 /workspace/huggingface_cache /home/appuser/.triton
|
28 |
|
29 |
+
# Set environment variables for Hugging Face and Triton cache
|
30 |
ENV HF_HOME=/workspace/huggingface_cache
|
31 |
ENV TRITON_CACHE_DIR=/home/appuser/.triton
|
32 |
|
|
|
|
|
|
|
33 |
# Set umask to ensure proper file permissions
|
34 |
RUN umask 002
|
35 |
|
36 |
+
# Copy the application code into the image
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
COPY . .
|
38 |
|
39 |
# Change ownership to non-root user
|
|
|
46 |
EXPOSE 7860
|
47 |
|
48 |
# Run the application
|
49 |
+
CMD ["python3", "app.py"]
|