qgallouedec HF Staff commited on
Commit
dee6b25
·
1 Parent(s): a946302
Files changed (1) hide show
  1. Dockerfile +31 -10
Dockerfile CHANGED
@@ -1,17 +1,38 @@
1
  # Base image with CUDA 12.8, cuDNN 9, PyTorch 2.7.0
2
  FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime
3
 
4
- # Install system tools (optional, like git, wget)
5
- RUN apt-get update && apt-get install -y \
6
- git \
7
- && rm -rf /var/lib/apt/lists/*
8
-
9
  # Set working directory
10
- WORKDIR /app
 
 
 
 
 
 
11
 
12
- # Copy and install Python dependencies
13
- COPY requirements.txt .
 
 
 
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
- # Default command: open Python shell
17
- CMD ["python"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Base image with CUDA 12.8, cuDNN 9, PyTorch 2.7.0
2
  FROM pytorch/pytorch:2.7.0-cuda12.8-cudnn9-runtime
3
 
 
 
 
 
 
4
  # Set working directory
5
+ WORKDIR /usr/src/app
6
+
7
+ # Install system dependencies, then clean up
8
+ RUN apt-get update && \
9
+ apt-get install -y --no-install-recommends git wget && \
10
+ apt-get clean && \
11
+ rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy application files
14
+ COPY . .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --upgrade pip
18
  RUN pip install --no-cache-dir -r requirements.txt
19
 
20
+ # Make script executable and move it to PATH
21
+ RUN install -m 755 sft.py /usr/local/bin/sft
22
+
23
+ # Create a non-root user
24
+ RUN useradd --create-home appuser
25
+ RUN chown -R appuser:appuser /usr/src/app
26
+
27
+ # Use non-root user
28
+ USER appuser
29
+
30
+ # Set environment variables
31
+ ENV XDG_CACHE_HOME=/usr/src/app/cache
32
+
33
+ # Expose the Gradio port
34
+ EXPOSE 7860
35
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
36
+
37
+ # Start the application
38
+ CMD ["python", "app.py"]