Tu Nombre commited on
Commit
da7ef91
·
1 Parent(s): 258cf05

Simplify Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -27
Dockerfile CHANGED
@@ -1,42 +1,22 @@
1
  FROM python:3.9
2
 
3
- # Setup
4
  RUN apt-get update && apt-get install -y curl wget netcat-traditional && \
5
  curl -fsSL https://ollama.com/install.sh | sh && \
6
  useradd -m -u 1000 user
7
 
8
  WORKDIR /app
9
-
10
- # Install dependencies
11
- COPY --chown=user requirements.txt .
12
- RUN pip install --no-cache-dir -r requirements.txt
13
-
14
- # Copy files
15
  COPY --chown=user . .
 
16
 
17
- # Create files
18
- COPY --chown=user Modelfile /app/Modelfile
19
-
20
- # Start script
21
- RUN echo '#!/bin/bash
22
- ulimit -v unlimited
23
- ollama serve --verbose &
24
- timeout=60
25
- until nc -z localhost 11434 || [ $timeout -le 0 ]; do
26
- sleep 1
27
- ((timeout--))
28
- done
29
- cd /app
30
- ollama create llama3.2:1b-papalia -f Modelfile
31
- exec uvicorn app:app --host 0.0.0.0 --port 7860 --workers 1 --limit-concurrency 1' > /app/start.sh
32
-
33
- RUN chmod +x /app/start.sh
34
 
35
  USER user
36
- ENV PATH="/home/user/.local/bin:$PATH" \
37
- MALLOC_ARENA_MAX=2
38
 
39
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
40
  CMD curl -f http://localhost:7860/health || exit 1
41
 
42
- CMD ["/app/start.sh"]
 
1
  FROM python:3.9
2
 
 
3
  RUN apt-get update && apt-get install -y curl wget netcat-traditional && \
4
  curl -fsSL https://ollama.com/install.sh | sh && \
5
  useradd -m -u 1000 user
6
 
7
  WORKDIR /app
 
 
 
 
 
 
8
  COPY --chown=user . .
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
 
11
+ RUN printf "#!/bin/bash\ncd /app\nollama serve & \
12
+ sleep 30 && ollama create llama3.2:1b-papalia -f Modelfile \
13
+ && exec uvicorn app:app --host 0.0.0.0 --port 7860 --workers 1" > start.sh \
14
+ && chmod +x start.sh
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
  USER user
17
+ ENV PATH="/home/user/.local/bin:$PATH"
 
18
 
19
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
20
  CMD curl -f http://localhost:7860/health || exit 1
21
 
22
+ CMD ["./start.sh"]