File size: 840 Bytes
3a9cb94
 
05768c5
 
 
 
 
 
2943a83
3a9cb94
 
ad821ef
 
 
 
10c440f
bf71041
10c440f
 
bf71041
10c440f
2d7f38d
3a9cb94
 
 
 
4c26e22
3a9cb94
4c77931
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
FROM python:3.9

# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1

# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1

WORKDIR /code

RUN --mount=type=secret,id=huggingface_token,mode=0444,required=true \
 git init && \
 git remote add origin $(cat /run/secrets/huggingface_token)

# Set the TRANSFORMERS_CACHE environment variable
#ENV TRANSFORMERS_CACHE=/tmp/.cache/huggingface

# Create the cache folder with appropriate permissions
#RUN mkdir -p $TRANSFORMERS_CACHE && chmod -R 777 $TRANSFORMERS_CACHE


COPY ./requirements.txt /code/requirements.txt

RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

COPY . . 

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