ffreemt commited on
Commit
b1edb56
·
1 Parent(s): 20024ee
Files changed (2) hide show
  1. Dockerfile +6 -0
  2. nginx.conf.template +17 -0
Dockerfile CHANGED
@@ -1,8 +1,14 @@
1
  FROM ollama/ollama:latest
2
 
 
 
 
3
  # Ensure external access within the container
4
  ENV OLLAMA_HOST=0.0.0.0
5
 
 
 
 
6
  # Copy a startup script
7
  COPY start.sh /start.sh
8
  RUN chmod +x /start.sh
 
1
  FROM ollama/ollama:latest
2
 
3
+ # Install Nginx
4
+ RUN apt-get update && apt-get install -y nginx gettext-base git && rm -rf /var/lib/apt/lists/*
5
+
6
  # Ensure external access within the container
7
  ENV OLLAMA_HOST=0.0.0.0
8
 
9
+ # Copy config and startup script
10
+ COPY nginx.conf.template /etc/nginx/nginx.conf.template
11
+
12
  # Copy a startup script
13
  COPY start.sh /start.sh
14
  RUN chmod +x /start.sh
nginx.conf.template ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ events {}
2
+ http {
3
+ server {
4
+ listen 7860;
5
+
6
+ location / {
7
+ # Check if the Authorization header matches our secret token
8
+ if ($http_authorization != "Bearer ${ACCESS_TOKEN}") {
9
+ return 401 "Unauthorized: Invalid API Key\n";
10
+ }
11
+
12
+ proxy_pass http://localhost:11434;
13
+ proxy_set_header Host $host;
14
+ proxy_set_header X-Real-IP $remote_addr;
15
+ }
16
+ }
17
+ }