File size: 849 Bytes
a2bb3c6
104c9ab
8ef6a4d
a2bb3c6
 
 
 
 
 
 
 
32efecf
a2bb3c6
8ef6a4d
 
a2bb3c6
 
32efecf
a2bb3c6
 
 
 
38dc4d9
a2bb3c6
104c9ab
8ef6a4d
a2bb3c6
32efecf
8ef6a4d
a2bb3c6
 
 
 
8ef6a4d
 
a2bb3c6
104c9ab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Use slim Python image
FROM python:3.10-slim

# Set environment variables for performance
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    OMP_NUM_THREADS=1 \
    MKL_NUM_THREADS=1 \
    OPENBLAS_NUM_THREADS=1 \
    VECLIB_MAXIMUM_THREADS=1 \
    NUMEXPR_NUM_THREADS=1

# Set working directory
WORKDIR /app

# Copy requirements and apt dependencies first
COPY requirements.txt apt.txt /app/

# Install system dependencies and clean up
RUN apt-get update && \
    xargs -a apt.txt apt-get install -y && \
    apt-get clean && rm -rf /var/lib/apt/lists/*

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Download spaCy model
RUN python -m spacy download en_core_web_sm

# Copy application files and models
COPY . /app/

# Expose Flask's default port
EXPOSE 7860

# Run the app
CMD ["python", "app.py"]