sreepathi-ravikumar commited on
Commit
7f12dea
·
verified ·
1 Parent(s): c35d203

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -10
Dockerfile CHANGED
@@ -1,17 +1,29 @@
1
- # Base image
2
- FROM python:3.10-slim
 
 
 
 
 
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Copy all files
8
- COPY . /app
9
-
10
- # Install dependencies
11
  RUN pip install --no-cache-dir -r requirements.txt
12
 
13
- # Expose the port you plan to use (match app.run port)
14
- EXPOSE 8080
 
 
 
 
 
 
 
 
 
15
 
16
- # Run the Flask app
17
- CMD ["python", "app.py"]
 
1
+ # Use lightweight Python image
2
+ FROM python:3.9-slim
3
+
4
+ # Install system dependencies for transformers
5
+ RUN apt-get update && \
6
+ apt-get install -y --no-install-recommends gcc python3-dev && \
7
+ rm -rf /var/lib/apt/lists/*
8
 
9
  # Set working directory
10
  WORKDIR /app
11
 
12
+ # Install Python dependencies
13
+ COPY requirements.txt .
 
 
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # Cache the AI model (Falcon-7B)
17
+ RUN python -c """
18
+ from transformers import pipeline
19
+ pipeline('text-generation', model='tiiuae/falcon-7b-instruct')
20
+ """
21
+
22
+ # Copy application files
23
+ COPY app.py text2generation.py ./
24
+
25
+ # Expose Hugging Face's default port
26
+ EXPOSE 7860
27
 
28
+ # Run the application with Gunicorn for production
29
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "app:app"]