BinaryONe commited on
Commit
1808f99
·
1 Parent(s): 398355f

Changing to No Data Persistance

Browse files
Files changed (4) hide show
  1. Dockerfile +16 -5
  2. Dockerfile1 +15 -0
  3. app.py +0 -0
  4. entrypoint.sh +0 -9
Dockerfile CHANGED
@@ -3,13 +3,24 @@ FROM ollama/ollama:latest
3
  # Expose your desired port
4
  EXPOSE 7860
5
 
6
- # Make Ollama listen on 0.0.0.0:7860 (default listens on 11434)
7
  ENV OLLAMA_HOST=0.0.0.0:7860
8
 
9
- RUN mkdir -p /.ollama/ && \
10
- chmod -R 777 /.ollama/
 
 
 
11
 
12
- #RUN py --version
 
 
13
 
14
- # Let the base image default ENTRYPOINT (ollama binary) run "serve"
 
 
 
 
 
 
15
  CMD ["serve"]
 
3
  # Expose your desired port
4
  EXPOSE 7860
5
 
6
+ # Configure Ollama to listen on all interfaces at port 7860
7
  ENV OLLAMA_HOST=0.0.0.0:7860
8
 
9
+ # Set environment to disable caching and history
10
+ ENV OLLAMA_NOHISTORY=true
11
+ ENV OLLAMA_MULTIUSER_CACHE=false
12
+ ENV OLLAMA_NOPRUNE=true
13
+ ENV OLLAMA_MODELS=/tmp/.ollama/models
14
 
15
+ # Create a temporary models directory in memory (optional: may require tmpfs mounting)
16
+ RUN mkdir -p /tmp/.ollama/models && \
17
+ chmod -R 777 /tmp/.ollama/models
18
 
19
+ # Use RAM-based directory (if Docker supports tmpfs)
20
+ VOLUME ["/tmp/.ollama/models"]
21
+
22
+ # Prevent model/key persistence
23
+ RUN rm -rf /.ollama && mkdir -p /.ollama && chmod -R 777 /.ollama
24
+
25
+ # Final command to serve
26
  CMD ["serve"]
Dockerfile1 ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM ollama/ollama:latest
2
+
3
+ # Expose your desired port
4
+ EXPOSE 7860
5
+
6
+ # Make Ollama listen on 0.0.0.0:7860 (default listens on 11434)
7
+ ENV OLLAMA_HOST=0.0.0.0:7860
8
+
9
+ RUN mkdir -p /.ollama/ && \
10
+ chmod -R 777 /.ollama/
11
+
12
+ #RUN py --version
13
+
14
+ # Let the base image default ENTRYPOINT (ollama binary) run "serve"
15
+ CMD ["serve"]
app.py ADDED
File without changes
entrypoint.sh DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Pull model if not present
3
- if ! ollama show "$model" >/dev/null 2>&1; then
4
- echo "Pulling model $model..."
5
- ollama pull "$model"
6
- fi
7
-
8
- # Serve binding to all interfaces; default Ollama host is 0.0.0.0:11434
9
- ollama serve --port 7860