File size: 682 Bytes
954e83c
 
 
 
 
 
e7d0142
 
 
954e83c
 
 
 
 
 
 
 
 
 
 
 
 
 
c7327da
 
03e4375
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
FROM python:3.10-slim

# Disable telemetry
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
    PIP_NO_CACHE_DIR=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    TRANSFORMERS_CACHE=/app/cache \
    HF_HOME=/app/cache

WORKDIR /app

# Install Python dependencies first (leverages Docker layer caching)
COPY requirements.txt ./
RUN pip install --upgrade pip && \
    pip install -r requirements.txt

# Copy the rest of the code
COPY . .

# Hugging Face sets the PORT env variable (default 7860)
EXPOSE 7860

RUN mkdir -p /app/cache && chmod 777 /app/cache

CMD bash -c "streamlit run app.py --server.port ${PORT:-7860} --server.address 0.0.0.0 --server.headless true"