File size: 879 Bytes
afd68f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# syntax=docker/dockerfile:1

FROM python:3.10-slim as base

# Install system dependencies and Ollama
RUN apt-get update && \
    apt-get install -y curl gnupg && \
    rm -rf /var/lib/apt/lists/* && \
    curl -fsSL https://ollama.com/install.sh | sh

# Create non-root user
RUN useradd --create-home --uid 1000 botuser

WORKDIR /app

# Pull models at build time
ENV OLLAMA_MODEL="qwen3"
ENV OLLAMA_EMBEDDING_MODEL="nomic-embed-text"
RUN ollama pull "$OLLAMA_MODEL" && ollama pull "$OLLAMA_EMBEDDING_MODEL"

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

# Copy application source
COPY . .

# Entrypoint script manages Ollama and the bot
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

USER botuser
ENV PYTHONUNBUFFERED=1

ENTRYPOINT ["/entrypoint.sh"]