danicor commited on
Commit
c4dce63
·
verified ·
1 Parent(s): c5d4ede

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +40 -0
Dockerfile ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM nvidia/cuda:12.1-base-ubuntu22.04
2
+
3
+ # Set environment variables
4
+ ENV PYTHONUNBUFFERED=1
5
+ ENV DEBIAN_FRONTEND=noninteractive
6
+ ENV HF_HOME=/app/huggingface
7
+ ENV TRANSFORMERS_CACHE=/app/huggingface
8
+
9
+ # Install system dependencies
10
+ RUN apt-get update && apt-get install -y \
11
+ python3 \
12
+ python3-pip \
13
+ python3-venv \
14
+ git \
15
+ wget \
16
+ curl \
17
+ && rm -rf /var/lib/apt/lists/*
18
+
19
+ # Create app directory
20
+ WORKDIR /app
21
+
22
+ # Copy requirements and install Python dependencies
23
+ COPY requirements.txt .
24
+ RUN pip3 install --no-cache-dir -r requirements.txt
25
+
26
+ # Copy application code
27
+ COPY . .
28
+
29
+ # Create huggingface cache directory
30
+ RUN mkdir -p /app/huggingface
31
+
32
+ # Expose port
33
+ EXPOSE 7860
34
+
35
+ # Health check
36
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
37
+ CMD curl -f http://localhost:7860/api/health || exit 1
38
+
39
+ # Start the application
40
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]