ninavacabsa commited on
Commit
6c40d39
·
verified ·
1 Parent(s): 3bbd1ff

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -13
Dockerfile CHANGED
@@ -7,37 +7,37 @@ RUN apt-get update && \
7
  # Install Ollama
8
  RUN curl -fsSL https://ollama.ai/install.sh | sh
9
 
10
- # Setup entrypoint script
11
- RUN echo $'#!/bin/bash\n\
12
  \n\
13
  # Start Ollama server\n\
14
  ollama serve > /dev/null 2>&1 &\n\
15
  \n\
16
- # Wait max 2 minutes for server to start\n\
17
  timeout=120\n\
18
  while ! curl -s localhost:11434 > /dev/null; do\n\
19
  sleep 1\n\
20
  ((timeout--))\n\
21
- if [ $timeout -eq 0 ]; then\n\
22
- echo "Timeout waiting for Ollama server";\n\
23
- exit 1;\n\
24
  fi\n\
25
  done\n\
26
  \n\
27
- # Pull model if not exists\n\
28
- if ! ollama list | grep -q "deepseek-r1:1.5b"; then\n\
29
- echo "Pulling model..."\n\
30
  ollama pull deepseek-r1:1.5b\n\
31
  fi\n\
32
  \n\
33
- # Forward port 7860 to 11434\n\
34
  socat TCP-LISTEN:7860,fork,reuseaddr TCP:127.0.0.1:11434 &\n\
35
  \n\
36
  # Health check endpoint\n\
37
  while true; do\n\
38
- echo -e "HTTP/1.1 200 OK\n\nOllama Ready" | nc -l -p 8080 -q 1\n\
39
- done\n\
40
- ' > /entrypoint.sh && chmod +x /entrypoint.sh
41
 
42
  EXPOSE 7860 8080
43
  VOLUME /root/.ollama
 
7
  # Install Ollama
8
  RUN curl -fsSL https://ollama.ai/install.sh | sh
9
 
10
+ # Setup entrypoint script dengan format Unix yang benar
11
+ RUN printf "#!/bin/bash\n\
12
  \n\
13
  # Start Ollama server\n\
14
  ollama serve > /dev/null 2>&1 &\n\
15
  \n\
16
+ # Wait max 2 menit untuk server start\n\
17
  timeout=120\n\
18
  while ! curl -s localhost:11434 > /dev/null; do\n\
19
  sleep 1\n\
20
  ((timeout--))\n\
21
+ if [ \$timeout -eq 0 ]; then\n\
22
+ echo \"Timeout waiting for Ollama server\"\n\
23
+ exit 1\n\
24
  fi\n\
25
  done\n\
26
  \n\
27
+ # Pull model jika belum ada\n\
28
+ if ! ollama list | grep -q \"deepseek-r1:1.5b\"; then\n\
29
+ echo \"Pulling model...\"\n\
30
  ollama pull deepseek-r1:1.5b\n\
31
  fi\n\
32
  \n\
33
+ # Port forwarding\n\
34
  socat TCP-LISTEN:7860,fork,reuseaddr TCP:127.0.0.1:11434 &\n\
35
  \n\
36
  # Health check endpoint\n\
37
  while true; do\n\
38
+ echo -e \"HTTP/1.1 200 OK\\n\\nOllama Ready\" | nc -l -p 8080 -q 1\n\
39
+ done\n" > /entrypoint.sh && \
40
+ chmod +x /entrypoint.sh
41
 
42
  EXPOSE 7860 8080
43
  VOLUME /root/.ollama