pradoth commited on
Commit
eef12c8
·
verified ·
1 Parent(s): ac94042

Upload Dockerfile with huggingface_hub

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -0
Dockerfile ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install system dependencies
6
+ RUN apt-get update && apt-get install -y \
7
+ wget \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Copy requirements and install Python dependencies
11
+ COPY requirements.txt .
12
+ RUN pip install --no-cache-dir -r requirements.txt
13
+
14
+ # Download spacy model (verify installation)
15
+ RUN python -m spacy download en_core_web_sm && \
16
+ python -c "import spacy; spacy.load('en_core_web_sm'); print('✓ Spacy model loaded successfully')"
17
+
18
+ # Copy application code
19
+ COPY . .
20
+
21
+ # Ensure start.sh is executable
22
+ RUN chmod +x start.sh && \
23
+ test -x start.sh && \
24
+ echo "✓ start.sh is executable"
25
+
26
+ # Create models directory if it doesn't exist
27
+ RUN mkdir -p models
28
+
29
+ # Set environment variables for Hugging Face Spaces
30
+ ENV PORT=7860
31
+ ENV PYTHONUNBUFFERED=1
32
+
33
+ # Expose port (Hugging Face Spaces requirement)
34
+ EXPOSE 7860
35
+
36
+ # Health check to verify the service is running
37
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
38
+ CMD wget --no-verbose --tries=1 --spider http://localhost:7860/health || exit 1
39
+
40
+ # Run the application with startup script
41
+ CMD ["./start.sh"]