-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathDockerfile
43 lines (35 loc) · 1.01 KB
/
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
43
FROM python:3.13-slim
# Accept build argument
ARG MODEL_NAME
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
git \
curl \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Install Ollama only for Ollama-based models
RUN case "$MODEL_NAME" in \
"llama3.2-vision:11b"|"llama3.2-vision:70b"|"llava:13b"|"llava:34b") \
curl -fsSL https://ollama.com/install.sh | sh \
;; \
esac
# Set working directory
WORKDIR /app
# Copy project files
COPY . .
# Install vision-parse with all optional dependencies
RUN pip install --no-cache-dir 'vision-parse[all]'
# Create a startup script
RUN echo '#!/bin/bash\n\
case "$MODEL_NAME" in\n\
"llama3.2-vision:11b"|"llama3.2-vision:70b"|"llava:13b"|"llava:34b")\n\
ollama serve > /var/log/ollama.log 2>&1 &\n\
sleep 10\n\
ollama pull $MODEL_NAME\n\
;;\n\
esac\n\
exec "$@"' > /start.sh && chmod +x /start.sh
ENTRYPOINT ["/start.sh"]
CMD ["tail", "-f", "/dev/null"]