File size: 1,394 Bytes
cc64683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261b188
 
 
 
cc64683
2797edd
 
f9b3bae
 
7fc0aba
cc64683
202afb6
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
43
44
45
46
47
48
49
50
51
52
53
54
55
# ==============================================================================
# Project Name: RAG LLM
# Script Name: Dockerfile
# Authors: Abraham Sánchez, Ulises Moya, Alejandro Zarate  
# Description:
#   This Python application provides an API service that retrieves answers to 
#   user queries based on the given context.
#
# License: MIT
# ==============================================================================

FROM python:3.12.8-slim

LABEL "author"="IIEG - Instituto de Información Estadística y Geografíca de Jalisco"

RUN apt update && \
    apt install --no-install-recommends -y \
    curl \
    libmagic-dev \
    ffmpeg \
    libsm6 \
    libxext6 \
    && apt clean \
    && apt autoremove \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /api

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

RUN pip install -U -q --no-cache-dir pip wheel
RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu

COPY rag/requirements.txt .

RUN pip install -r requirements.txt

ADD rag/app/ /api/app/
ADD rag/models/ /api/models/
ADD rag/taggers/ /api/taggers/
ADD rag/tokenizers/ /api/tokenizers/

RUN mkdir -p /api/rag/models/hub

RUN chmod -R 777 /api

EXPOSE 7860

CMD ["hypercorn", "app.main:app", "--bind", "0.0.0.0:7860", "--access-logfile", "-"]