Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +5 -5
Dockerfile
CHANGED
@@ -4,6 +4,9 @@ FROM python:3.12.5
|
|
4 |
# Install Ollama as root
|
5 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
6 |
|
|
|
|
|
|
|
7 |
# Create a new user and switch to it
|
8 |
RUN useradd -m -u 1000 user
|
9 |
USER user
|
@@ -16,14 +19,11 @@ WORKDIR /app
|
|
16 |
COPY --chown=user ./requirements.txt requirements.txt
|
17 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
18 |
|
19 |
-
# Pull the Llama3 model (or any other model you need)
|
20 |
-
RUN ollama pull llama3
|
21 |
-
|
22 |
# Copy application code
|
23 |
COPY --chown=user . /app
|
24 |
|
25 |
# Expose FastAPI default port
|
26 |
EXPOSE 7860
|
27 |
|
28 |
-
#
|
29 |
-
CMD ["
|
|
|
4 |
# Install Ollama as root
|
5 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
6 |
|
7 |
+
# Start Ollama in the background and pull the model
|
8 |
+
RUN ollama serve & sleep 5 && ollama pull llama3
|
9 |
+
|
10 |
# Create a new user and switch to it
|
11 |
RUN useradd -m -u 1000 user
|
12 |
USER user
|
|
|
19 |
COPY --chown=user ./requirements.txt requirements.txt
|
20 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
21 |
|
|
|
|
|
|
|
22 |
# Copy application code
|
23 |
COPY --chown=user . /app
|
24 |
|
25 |
# Expose FastAPI default port
|
26 |
EXPOSE 7860
|
27 |
|
28 |
+
# Start Ollama and FastAPI together
|
29 |
+
CMD ["sh", "-c", "ollama serve & uvicorn app:app --host 0.0.0.0 --port 7860"]
|