WebashalarForML commited on
Commit
bdf22b9
·
verified ·
1 Parent(s): 4c5e080

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +52 -0
Dockerfile ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official Python runtime as a parent image
2
+ FROM python:3.11-slim
3
+
4
+ # Set environment variables for Python
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1
7
+
8
+ # Set environment variables for Hugging Face cache
9
+ ENV TRANSFORMERS_CACHE=/app/cache \
10
+ HF_HOME=/app/cache
11
+
12
+ # Set the working directory
13
+ WORKDIR /app
14
+
15
+ # Install system dependencies
16
+ #RUN apt-get update && apt-get install -y \
17
+ # libgl1 \
18
+ # libglib2.0-0 \
19
+ # libsm6 \
20
+ # libxrender1 \
21
+ # libxext6 \
22
+ # file \
23
+ # && rm -rf /var/lib/apt/lists/*
24
+
25
+ #adding the poppler
26
+ #RUN apt-get update && apt-get install -y poppler-utils
27
+
28
+ #adding the poppler
29
+ #RUN apt-get update && apt-get install -y tesseract-ocr
30
+
31
+ # Copy the requirements file into the container at /app
32
+ COPY requirements.txt /app/
33
+
34
+ # Install dependencies
35
+ RUN pip install --no-cache-dir -r requirements.txt
36
+
37
+ # Create and set permissions for the cache directory
38
+ RUN mkdir -p /app/cache /app/blocks /app/generated_projects /app/static /app/static/assets && \
39
+ chmod -R 777 /app/cache /app/blocks /app/generated_projects /app/static /app/static/assets
40
+
41
+ # Copy the rest of the application code to /app
42
+ COPY . /app/
43
+
44
+ # Set environment variables for Flask
45
+ ENV FLASK_APP=app.py \
46
+ FLASK_ENV=production
47
+
48
+ # Expose the port the app runs on
49
+ EXPOSE 7860
50
+
51
+ # Command to run the application
52
+ CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "0", "app:app"]