File size: 737 Bytes
05f67c9
bdae3c4
e316740
05f67c9
bdae3c4
cecf722
05f67c9
 
628038a
bdae3c4
cecf722
bdae3c4
3501991
bdae3c4
64b6655
800099a
 
 
 
64b6655
 
800099a
bdae3c4
628038a
bdae3c4
64b6655
bdae3c4
cecf722
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
FROM python:3.11-slim

RUN apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://ollama.com/install.sh | sh

WORKDIR /app
COPY requirements.txt .
COPY app.py .
COPY database.py .

RUN pip install --no-cache-dir -r requirements.txt

EXPOSE 7860

# LOOP + MODELO LEVE
RUN ollama serve & \
    until curl -s http://localhost:11434/api/tags > /dev/null; do \
        echo "Aguardando Ollama..." && sleep 2; \
    done && \
    echo "Ollama pronto! Puxando qwen2.5:0.5b-instruct-q4_0..." && \
    ollama pull qwen2.5:0.5b-instruct-q4_0 && \
    kill $!

HEALTHCHECK --interval=30s CMD curl -f http://localhost:7860/health || exit 1

ENV OLLAMA_NUM_PARALLEL=1

CMD ["python", "app.py"]