entropy25 commited on
Commit
cb98768
·
verified ·
1 Parent(s): 261f6e9

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +42 -0
Dockerfile ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9-slim
2
+
3
+ # Set working directory
4
+ WORKDIR /app
5
+
6
+ # Install system dependencies
7
+ RUN apt-get update && apt-get install -y \
8
+ gcc \
9
+ g++ \
10
+ git \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Copy requirements first for better caching
14
+ COPY requirements.txt .
15
+
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir -r requirements.txt
18
+
19
+ # Download NLTK data
20
+ RUN python -c "import nltk; nltk.download('stopwords'); nltk.download('punkt')"
21
+
22
+ # Copy application code
23
+ COPY . .
24
+
25
+ # Create non-root user for security
26
+ RUN useradd -m -u 1000 user
27
+ RUN chown -R user:user /app
28
+ USER user
29
+
30
+ # Expose port
31
+ EXPOSE 7860
32
+
33
+ # Set environment variables
34
+ ENV GRADIO_SERVER_NAME="0.0.0.0"
35
+ ENV GRADIO_SERVER_PORT=7860
36
+
37
+ # Health check
38
+ HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
39
+ CMD curl -f http://localhost:7860 || exit 1
40
+
41
+ # Run the application
42
+ CMD ["python", "main.py"]