goldfishsoftwarelabs commited on
Commit
a3a1847
·
verified ·
1 Parent(s): afd1b76

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -5
Dockerfile CHANGED
@@ -8,9 +8,9 @@ RUN pip3 install fastapi uvicorn requests
8
  # Create a directory for persistent storage (Hugging Face Spaces uses /data)
9
  RUN mkdir -p /data/.ollama && ln -s /data/.ollama /root/.ollama
10
 
11
- # Copy the entrypoint script
12
- COPY entrypoint.sh /entrypoint.sh
13
- RUN chmod +x /entrypoint.sh
14
 
15
  # Copy the FastAPI app
16
  COPY app.py /app.py
@@ -18,5 +18,8 @@ COPY app.py /app.py
18
  # Expose the port for the FastAPI server (Hugging Face Spaces uses 8000)
19
  EXPOSE 8000
20
 
21
- # Use the default Ollama entrypoint and pass the custom script as a command
22
- CMD ["/entrypoint.sh"]
 
 
 
 
8
  # Create a directory for persistent storage (Hugging Face Spaces uses /data)
9
  RUN mkdir -p /data/.ollama && ln -s /data/.ollama /root/.ollama
10
 
11
+ # Copy the startup script for model pulling and FastAPI
12
+ COPY startup.sh /startup.sh
13
+ RUN chmod +x /startup.sh
14
 
15
  # Copy the FastAPI app
16
  COPY app.py /app.py
 
18
  # Expose the port for the FastAPI server (Hugging Face Spaces uses 8000)
19
  EXPOSE 8000
20
 
21
+ # Run ollama serve as the main command
22
+ CMD ["serve"]
23
+
24
+ # Start the startup script in the background during container initialization
25
+ RUN echo "/startup.sh &" >> /etc/profile.d/startup.sh