vinay0123 commited on
Commit
a2bb3c6
·
verified ·
1 Parent(s): 6fcea15

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -18
Dockerfile CHANGED
@@ -1,32 +1,37 @@
 
1
  FROM python:3.10-slim
2
 
3
- ENV PYTHONDONTWRITEBYTECODE=1
4
- ENV PYTHONUNBUFFERED=1
5
- ENV OMP_NUM_THREADS=1
6
- ENV MKL_NUM_THREADS=1
7
- ENV OPENBLAS_NUM_THREADS=1
8
- ENV VECLIB_MAXIMUM_THREADS=1
9
- ENV NUMEXPR_NUM_THREADS=1
10
-
11
- FROM python:3.10-slim
12
-
13
- ENV PYTHONDONTWRITEBYTECODE=1
14
- ENV PYTHONUNBUFFERED=1
15
 
 
16
  WORKDIR /app
17
 
18
- COPY requirements.txt /app/
19
- COPY . /app
20
 
21
- RUN apt-get update && apt-get install -y gcc git \
22
- && rm -rf /var/lib/apt/lists/*
 
 
23
 
 
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
26
- # Download spacy English model
27
  RUN python -m spacy download en_core_web_sm
28
 
 
 
 
 
29
  EXPOSE 7860
30
 
 
31
  CMD ["python", "app.py"]
32
-
 
1
+ # Use slim Python image
2
  FROM python:3.10-slim
3
 
4
+ # Set environment variables for performance
5
+ ENV PYTHONDONTWRITEBYTECODE=1 \
6
+ PYTHONUNBUFFERED=1 \
7
+ OMP_NUM_THREADS=1 \
8
+ MKL_NUM_THREADS=1 \
9
+ OPENBLAS_NUM_THREADS=1 \
10
+ VECLIB_MAXIMUM_THREADS=1 \
11
+ NUMEXPR_NUM_THREADS=1
 
 
 
 
12
 
13
+ # Set working directory
14
  WORKDIR /app
15
 
16
+ # Copy requirements and apt dependencies first
17
+ COPY requirements.txt apt.txt /app/
18
 
19
+ # Install system dependencies and clean up
20
+ RUN apt-get update && \
21
+ xargs -a apt.txt apt-get install -y && \
22
+ apt-get clean && rm -rf /var/lib/apt/lists/*
23
 
24
+ # Install Python dependencies
25
  RUN pip install --no-cache-dir -r requirements.txt
26
 
27
+ # Download spaCy model
28
  RUN python -m spacy download en_core_web_sm
29
 
30
+ # Copy application files and models
31
+ COPY . /app/
32
+
33
+ # Expose Flask's default port
34
  EXPOSE 7860
35
 
36
+ # Run the app
37
  CMD ["python", "app.py"]