File size: 747 Bytes
d76e7e6
 
 
 
 
b966f5f
 
 
 
d76e7e6
 
 
 
 
 
 
 
 
 
b966f5f
 
d76e7e6
 
 
 
ea67212
 
d76e7e6
 
 
ea67212
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
FROM python:3.11-slim

ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PIP_NO_CACHE_DIR=1 \
    PORT=7860 \
    HF_HOME=/tmp/hf-cache \
    TRANSFORMERS_CACHE=/tmp/hf-cache \
    TORCH_HOME=/tmp/torch-cache

WORKDIR /workspace

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        build-essential \
        git \
        libgomp1 \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p "${HF_HOME}" "${TORCH_HOME}" && chmod -R 777 "${HF_HOME}" "${TORCH_HOME}"

COPY . .

WORKDIR /workspace/apps/api

RUN python -m pip install --upgrade pip setuptools wheel && \
    python -m pip install --no-cache-dir -r requirements.txt

EXPOSE ${PORT}

CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]