AARANHA commited on
Commit
01aa868
·
verified ·
1 Parent(s): 8c89b4a

Create Dockerfile

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