WebashalarForML commited on
Commit
1af3618
·
verified ·
1 Parent(s): 31fd85f

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +37 -0
Dockerfile ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ # Environment variables
4
+ ENV PYTHONDONTWRITEBYTECODE=1 \
5
+ PYTHONUNBUFFERED=1 \
6
+ TRANSFORMERS_CACHE=/app/cache \
7
+ HF_HOME=/app/cache \
8
+ MPLCONFIGDIR=/tmp
9
+
10
+ WORKDIR /app
11
+
12
+ # Copy the requirements file
13
+ COPY requirements.txt /app/
14
+
15
+ # Upgrade pip
16
+ RUN pip install --upgrade pip
17
+
18
+ # (Optional) Install any necessary system dependencies
19
+ #RUN apt-get update && apt-get install -y gcc libjpeg-dev zlib1g-dev && \
20
+ # rm -rf /var/lib/apt/lists/*
21
+
22
+ # Install dependencies
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Create cache directory and set permissions
26
+ RUN mkdir -p /app/cache /app/uploads /app/data && chmod -R 777 /app/cache /app/uploads /app/data
27
+ RUN chmod -R 777 /app
28
+
29
+ # Copy the application code
30
+ COPY . /app/
31
+
32
+ ENV FLASK_APP=app.py \
33
+ FLASK_ENV=production
34
+
35
+ EXPOSE 7860
36
+
37
+ CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "120", "app:app"]