File size: 692 Bytes
2a2c039
 
 
 
 
 
 
 
 
 
 
cfc2b8e
 
2a2c039
 
cfc2b8e
 
2a2c039
 
cfc2b8e
 
 
 
2a2c039
 
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
FROM python:3.10-slim

RUN useradd -m -u 1000 user
RUN apt-get update && apt-get install -y --no-install-recommends build-essential git && rm -rf /var/lib/apt/lists/*

USER user
ENV PATH="/home/user/.local/bin:$PATH"
ENV HF_HOME="/home/user/.cache/huggingface"
ENV HF_HUB_DISABLE_SYMLINKS_WARNING=1

WORKDIR /app

# Install dependencies first (cached layer)
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy all code
COPY --chown=user . /app

# Pre-download models and build index during Docker build
# This means startup will be fast (seconds, not hours)
RUN python startup.py

EXPOSE 7860
CMD ["python", "web_app.py"]