RAG-Test / dockerfile
Nielo47's picture
Update space
3226705
raw
history blame
807 Bytes
FROM python:3.10-slim
# 1) Install curl, Ollama CLI, and procps (for pkill/killall)
RUN apt-get update \
&& apt-get install -y curl procps \
&& curl -fsSL https://ollama.com/install.sh | sh \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# 2) Create non‑root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /home/user/app
# 3) Install Python dependencies
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# 4) Pre‑pull Ollama models during build
RUN ollama serve & \
sleep 15 && \
ollama pull nomic-embed-text && \
ollama pull gemma3:1b && \
pkill ollama
# 5) Copy application code and startup script
COPY --chown=user:user . ./
RUN chmod +x start.sh
# 6) Default command
CMD ["./start.sh"]