Spaces:
Runtime error
Runtime error
Create Dockerfile
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Base image with Python support
|
2 |
+
FROM python:3.9
|
3 |
+
|
4 |
+
# Install dependencies for Ollama installation script (optional)
|
5 |
+
RUN apt-get update && apt-get install -y curl wget
|
6 |
+
|
7 |
+
# Download and potentially execute Ollama installation script (commented out)
|
8 |
+
RUN curl -fsSL https://ollama.com/install.sh | /bin/bash -
|
9 |
+
|
10 |
+
# **Alternative: Install Ollama using a package manager (if available)**
|
11 |
+
RUN pip install ollama
|
12 |
+
|
13 |
+
# Set working directory
|
14 |
+
WORKDIR /
|
15 |
+
|
16 |
+
COPY requirements.txt /app/requirements.txt
|
17 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
18 |
+
|
19 |
+
# Copy your FastAPI application code (assuming 'main.py')
|
20 |
+
COPY main.py .
|
21 |
+
|
22 |
+
# Start Ollama server in the background
|
23 |
+
RUN nohup ollama &
|
24 |
+
|
25 |
+
# Download the Mistral model (modify URL if needed)
|
26 |
+
RUN sleep 15 && ollama pull mistral
|
27 |
+
|
28 |
+
# Expose Ollama server port (commented out)
|
29 |
+
# EXPOSE 11434 # Not required for this approach
|
30 |
+
|
31 |
+
# **Entrypoint command: Run Uvicorn server**
|
32 |
+
CMD [ "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860" ]
|