File size: 983 Bytes
4afd4ad
 
a83a398
4afd4ad
a83a398
 
 
 
812f613
332856d
812f613
 
 
332856d
812f613
 
5fa015f
c99fdb0
 
4afd4ad
c99fdb0
 
 
812f613
 
c99fdb0
 
 
 
 
 
 
4afd4ad
a83a398
4afd4ad
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
FROM python:3.9

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y espeak-ng

# Set writable cache directories
ENV HF_HOME="/app/.cache/huggingface"
ENV XDG_CACHE_HOME="/app/.cache"
ENV PIP_CACHE_DIR="/app/.cache/pip"
ENV TRANSFORMERS_CACHE="/app/.cache/huggingface"

# Ensure cache directories exist and have correct permissions
RUN mkdir -p $HF_HOME $XDG_CACHE_HOME $PIP_CACHE_DIR $TRANSFORMERS_CACHE && chmod -R 777 /app/.cache

# Copy requirements first to leverage Docker cache
COPY requirements.txt .

# Upgrade pip and install dependencies globally (without --user)
RUN pip install --no-cache-dir --upgrade pip \
    && pip install --no-cache-dir -r requirements.txt

# Install SpaCy model explicitly under /app to avoid permission issues
RUN python -m spacy download en_core_web_sm

# Copy project files
COPY . .

# Ensure Flask is installed
RUN python -m pip show flask

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