File size: 670 Bytes
f2139e9
 
ce5512e
258cf05
 
f2139e9
 
258cf05
da7ef91
2681e2a
da7ef91
 
 
 
f2139e9
 
da7ef91
f2139e9
2681e2a
258cf05
bc742f7
da7ef91
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM python:3.9

RUN apt-get update && apt-get install -y curl wget netcat-traditional && \
   curl -fsSL https://ollama.com/install.sh | sh && \
   useradd -m -u 1000 user

WORKDIR /app
COPY --chown=user . .
RUN pip install --no-cache-dir -r requirements.txt

RUN printf "#!/bin/bash\ncd /app\nollama serve & \
sleep 30 && ollama create llama3.2:1b-papalia -f Modelfile \
&& exec uvicorn app:app --host 0.0.0.0 --port 7860 --workers 1" > start.sh \
&& chmod +x start.sh

USER user
ENV PATH="/home/user/.local/bin:$PATH"

HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
   CMD curl -f http://localhost:7860/health || exit 1

CMD ["./start.sh"]