OLLAMA / Dockerfile
akra35567's picture
Update Dockerfile
9013a07 verified
raw
history blame
1.01 kB
# Dockerfile
FROM python:3.11-slim
# INSTALA DEPENDÊNCIAS DO SISTEMA
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# BAIXA E INSTALA OLLAMA
RUN curl -fsSL https://ollama.com/install.sh | sh
# CRIA DIRETÓRIO
WORKDIR /app
# COPIA ARQUIVOS
COPY requirements.txt .
COPY app.py .
# INSTALA PYTHON DEPENDÊNCIAS
RUN pip install --no-cache-dir -r requirements.txt
# PORTAS
EXPOSE 7860
EXPOSE 11434
# === PUXA MODELO CORRETO: qwen2.5:3b-instruct-q4_0 ===
RUN ollama serve & \
OLLAMA_PID=$! && \
sleep 25 && \
ollama pull qwen2.5:3b-instruct-q4_0 && \
kill $OLLAMA_PID || true
# HEALTHCHECK
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# VARIÁVEIS DE AMBIENTE
ENV OLLAMA_NUM_PARALLEL=3
ENV OLLAMA_MAX_QUEUE=10
ENV OLLAMA_KEEP_ALIVE=10m
ENV OLLAMA_MAX_LOADED_MODELS=1
# INICIA app.py
CMD ["python", "app.py"]