File size: 1,881 Bytes
90a2f0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1103360
 
 
 
 
90a2f0d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
# ==========================================================
# Base Image
# ==========================================================
FROM python:3.11-slim

# Prevent Python from writing .pyc files
ENV PYTHONDONTWRITEBYTECODE=1

# Print logs immediately
#this is important for Docker logs to be visible in real-time
ENV PYTHONUNBUFFERED=1

# Hugging Face cache location
ENV HF_HOME=/app/.cache/huggingface
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface
ENV SENTENCE_TRANSFORMERS_HOME=/app/.cache/huggingface

# Streamlit
ENV STREAMLIT_SERVER_PORT=7860
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0

# ==========================================================
# System Dependencies
# ==========================================================
RUN apt-get update && apt-get install -y \
    build-essential \
    git \
    curl \
    libgl1 \
    libglib2.0-0 \
    libsm6 \
    libxext6 \
    libxrender-dev \
    && rm -rf /var/lib/apt/lists/*

# ==========================================================
# Working Directory
# ==========================================================
WORKDIR /app

# ==========================================================
# Install Python Packages
# ==========================================================
COPY requirements.txt .

RUN pip install --upgrade pip

RUN pip install --no-cache-dir -r requirements.txt

# ==========================================================
# Copy Project
# ==========================================================
COPY . .

# ==========================================================
# Expose Streamlit Port
# ==========================================================
EXPOSE 7860

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