File size: 973 Bytes
747bec2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f9f157c
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
FROM python:3.10-slim

ARG HF_TOKEN

ENV DEBIAN_FRONTEND=noninteractive \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    HF_TOKEN=${HF_TOKEN}

WORKDIR /code

# System Dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    git \
    curl \
    libopenblas-dev \
    libomp-dev \
    && rm -rf /var/lib/apt/lists/*

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

# Hugging Face dependencies
RUN pip install --no-cache-dir huggingface-hub sentencepiece

# Hugging Face cache environment
ENV HF_HOME=/data/huggingface \
    HUGGINGFACE_HUB_CACHE=/data/huggingface \
    HF_HUB_CACHE=/data/huggingface \
    API_PORT=7860

# Create cache dir and set permissions
RUN mkdir -p /data/huggingface && chmod -R 777 /data

# Copy project files
COPY . .

EXPOSE 7860

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