vinay0123 commited on
Commit
104c9ab
·
verified ·
1 Parent(s): 1dd4ebf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -27
Dockerfile CHANGED
@@ -1,37 +1,35 @@
1
- FROM python:3.9-slim
2
 
3
- # System dependencies required for Python packages
4
- RUN apt-get update && apt-get install -y --no-install-recommends \
5
- build-essential \
6
- gcc \
7
- curl \
8
- && rm -rf /var/lib/apt/lists/*
 
9
 
10
- # Set working directory
11
  WORKDIR /app
12
 
13
- # Install blis and googletrans separately to avoid building from source
14
- RUN pip install --no-cache-dir --prefer-binary \
15
- blis==0.7.9 \
16
- googletrans==4.0.0rc1
 
 
17
 
18
- # Copy requirements and install remaining dependencies
19
- COPY requirements.txt .
20
- RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
21
 
22
- # Download spaCy model
23
- RUN python -m spacy download en_core_web_sm
24
 
25
- # Copy your application
26
- COPY . .
 
 
27
 
28
- # Expose required port
29
  EXPOSE 7860
30
 
31
- # Flask environment config
32
- ENV FLASK_APP=app.py
33
- ENV FLASK_RUN_PORT=7860
34
- ENV FLASK_RUN_HOST=0.0.0.0
35
-
36
- # Run the Flask server
37
- CMD ["flask", "run"]
 
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
  WORKDIR /app
12
 
13
+ # Install system dependencies
14
+ RUN apt-get update && apt-get install -y \
15
+ gcc \
16
+ git \
17
+ build-essential \
18
+ && rm -rf /var/lib/apt/lists/*
19
 
20
+ # Copy requirements first for better caching
21
+ COPY requirements.txt /app/
22
+ RUN pip install --no-cache-dir -r requirements.txt
23
 
24
+ # Copy the rest of the application
25
+ COPY . /app
26
 
27
+ # Set environment variables for PyTorch
28
+ ENV TORCH_CUDA_VERSION=cu118
29
+ ENV TORCH_NVCC_FLAGS="-Xfatbin -compress-all"
30
+ ENV PYTORCH_CUDA_ALLOC_CONF=max_split_size_mb:512
31
 
 
32
  EXPOSE 7860
33
 
34
+ # Run with multiple workers for better CPU utilization
35
+ CMD ["python", "app.py"]