File size: 933 Bytes
633d9b3
 
 
 
 
 
 
 
7a84c6b
633d9b3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7a84c6b
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
# Use an official Python runtime as a parent image
FROM python:3.12-slim-bookworm

# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Ensure HF_TOKEN is picked up from the environment
# ENV HF_TOKEN=${HUGGINGFACE_TOKEN}

# Set work directory in the container
WORKDIR /code

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
    gcc \
    default-libmysqlclient-dev \
    && rm -rf /var/lib/apt/lists/*

# Create the cache directory
RUN mkdir -p /models/cache

# Ensure the directory is writable
RUN chmod -R 777 /models/cache

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

# Copy the current directory contents into the container at /code
COPY ./api /code/api

# Run the command to start uWSGI
# Run Huggingface CLI login during runtime
CMD ["sh", "-c", "gunicorn -b 0.0.0.0:7860 api.app:app"]