File size: 1,454 Bytes
730a73f
1e420ee
730a73f
 
e283842
 
1e420ee
730a73f
629cf54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
730a73f
 
8a2bf6c
1e420ee
 
e283842
68226ff
 
 
 
 
 
629cf54
8a2bf6c
7f42a56
1e420ee
8a2bf6c
 
 
629cf54
e283842
 
 
 
 
7f42a56
1e420ee
264312d
9c98458
730a73f
e283842
730a73f
 
8a2bf6c
629cf54
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
FROM python:3.11-slim

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_CACHE=/app/.cache
ENV HF_HOME=/app/.cache

# Install system dependencies
RUN apt-get update && apt-get install -y \
    wget \
    curl \
    libnss3 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libxkbcommon0 \
    libxcomposite1 \
    libxrandr2 \
    libasound2 \
    libpangocairo-1.0-0 \
    libxdamage1 \
    libgbm1 \
    libpango-1.0-0 \
    libgtk-3-0 \
    gcc

# Copy and install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Install additional libraries
RUN pip install -U \
    transformers \
    sentence-transformers \
    huggingface_hub \
    accelerate \
    peft

# Install Playwright and Browsers
RUN pip install playwright && playwright install --with-deps chromium

# Copy app files
COPY . /app
WORKDIR /app

# Create cache directory and set permissions
RUN mkdir -p /app/.cache && \
    chmod -R 777 /app/.cache

# Set appropriate permissions for the entire app
RUN chmod -R 755 /app

# Preload SentenceTransformer model
RUN python -c "import os; os.environ['HF_HOME'] = '/workspace/.cache'; from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2', cache_folder='/workspace/.cache')"

# Expose port
EXPOSE 7860

# Run the app
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]