-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
42 lines (32 loc) · 811 Bytes
/
Dockerfile
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
# Base image with Python and Ollama
FROM ollama/ollama:latest AS ollama
# Final image
FROM python:3.11-slim
# Copy Ollama binary from ollama image
COPY --from=ollama /usr/bin/ollama /usr/bin/ollama
# Set working directory
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
curl \
procps \
&& rm -rf /var/lib/apt/lists/*
# Copy project files
COPY . .
# Install dependencies
RUN pip install --no-cache-dir .
# Download Ollama model
RUN ollama serve & \
sleep 5 && \
ollama pull llama3:latest && \
pkill ollama
# Create startup script
COPY docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh
# Expose ports
# 11434 - Ollama API
EXPOSE 11434
# 8000 - FastAPI
EXPOSE 8000
# Set entrypoint
ENTRYPOINT ["docker-entrypoint.sh"]