Gaston895 commited on
Commit
ef1415f
·
verified ·
1 Parent(s): 55cb1de

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -0
Dockerfile ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ build-essential \
9
+ curl \
10
+ git \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements first for better caching
14
+ COPY requirements_gunicorn.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements_gunicorn.txt
18
+
19
+ # Copy application files only (model will be downloaded from HF)
20
+ COPY app_gunicorn.py .
21
+ COPY gunicorn_config.py .
22
+
23
+ # Create non-root user
24
+ RUN useradd -m -u 1000 user
25
+ RUN chown -R user:user /app
26
+ USER user
27
+
28
+ # Expose port
29
+ EXPOSE 7860
30
+
31
+ # Health check
32
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=120s --retries=3 \
33
+ CMD curl -f http://localhost:7860/health || exit 1
34
+
35
+ # Start with Gunicorn
36
+ CMD ["gunicorn", "--config", "gunicorn_config.py", "app_gunicorn:app"]