WebashalarForML commited on
Commit
d1ee18c
·
verified ·
1 Parent(s): 7eced5b

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +39 -0
Dockerfile ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ RUN apt-get update && apt-get install -y libgomp1
19
+
20
+ # (Optional) Install any necessary system dependencies
21
+ RUN apt-get update && apt-get install -y gcc libjpeg-dev zlib1g-dev && \
22
+ rm -rf /var/lib/apt/lists/*
23
+
24
+ # Install dependencies
25
+ RUN pip install --no-cache-dir -r requirements.txt
26
+
27
+ # Create cache directory and set permissions
28
+ RUN mkdir -p /app/cache /app/uploads /app/data /app/models && chmod -R 777 /app/cache /app/uploads /app/data /app/models
29
+ RUN chmod -R 777 /app
30
+
31
+ # Copy the application code
32
+ COPY . /app/
33
+
34
+ ENV FLASK_APP=app.py \
35
+ FLASK_ENV=production
36
+
37
+ EXPOSE 7860
38
+
39
+ CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "600", "app:app"]