Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +5 -23
Dockerfile
CHANGED
@@ -1,36 +1,18 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
# Set the working directory in the container
|
4 |
WORKDIR /app
|
5 |
|
6 |
-
# Install system
|
7 |
-
RUN apt-get update && apt-get install -y
|
8 |
-
python3 \
|
9 |
-
python3-pip \
|
10 |
-
curl \
|
11 |
-
&& rm -rf /var/lib/apt/lists/*
|
12 |
-
|
13 |
-
# Set Python3 as the default
|
14 |
-
RUN ln -s /usr/bin/python3 /usr/bin/python
|
15 |
|
16 |
# Install Ollama
|
17 |
RUN curl -fsSL https://ollama.com/install.sh | bash
|
18 |
-
|
19 |
-
# Ensure Ollama is in the system path
|
20 |
ENV PATH="/root/.ollama/bin:$PATH"
|
21 |
|
22 |
-
|
23 |
-
RUN ollama serve & sleep 5 && ollama pull mannix/defog-llama3-sqlcoder-8b
|
24 |
-
|
25 |
-
# Copy the requirements file and install dependencies
|
26 |
COPY requirements.txt ./
|
27 |
RUN pip install --no-cache-dir -r requirements.txt
|
28 |
-
|
29 |
-
# Copy the application files
|
30 |
COPY . .
|
31 |
|
32 |
-
# Expose the FastAPI default port
|
33 |
EXPOSE 8000
|
34 |
-
|
35 |
-
# Start Ollama and FastAPI
|
36 |
-
CMD ["sh", "-c", "ollama serve & uvicorn main:app --host 0.0.0.0 --port 8000"]
|
|
|
1 |
+
FROM python:3.11-slim as base
|
2 |
|
|
|
3 |
WORKDIR /app
|
4 |
|
5 |
+
# Install system tools
|
6 |
+
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
# Install Ollama
|
9 |
RUN curl -fsSL https://ollama.com/install.sh | bash
|
|
|
|
|
10 |
ENV PATH="/root/.ollama/bin:$PATH"
|
11 |
|
12 |
+
COPY models /root/.ollama/models/
|
|
|
|
|
|
|
13 |
COPY requirements.txt ./
|
14 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
|
15 |
COPY . .
|
16 |
|
|
|
17 |
EXPOSE 8000
|
18 |
+
CMD ["sh", "-c", "ollama serve & uvicorn app.main:app --host 0.0.0.0 --port 8000"]
|
|
|
|