Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +19 -3
Dockerfile
CHANGED
|
@@ -1,13 +1,29 @@
|
|
|
|
|
| 1 |
FROM ubuntu:22.04
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# Install dependencies
|
| 4 |
-
RUN apt update && apt install -y
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# Install Ollama
|
| 7 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 8 |
|
| 9 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
EXPOSE 11434
|
| 11 |
|
| 12 |
-
#
|
| 13 |
CMD ["ollama", "serve"]
|
|
|
|
| 1 |
+
# Use an official lightweight Ubuntu base image
|
| 2 |
FROM ubuntu:22.04
|
| 3 |
|
| 4 |
+
# Set environment variables
|
| 5 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 6 |
+
ENV OLLAMA_HOME=/home/user/.ollama
|
| 7 |
+
|
| 8 |
+
# Create a non-root user to avoid permission issues
|
| 9 |
+
RUN useradd -m -s /bin/bash user
|
| 10 |
+
|
| 11 |
# Install dependencies
|
| 12 |
+
RUN apt update && apt install -y \
|
| 13 |
+
curl git && \
|
| 14 |
+
rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
# Install Ollama
|
| 17 |
RUN curl -fsSL https://ollama.com/install.sh | sh
|
| 18 |
|
| 19 |
+
# Ensure the Ollama home directory is writable
|
| 20 |
+
RUN mkdir -p $OLLAMA_HOME && chown -R user:user $OLLAMA_HOME
|
| 21 |
+
|
| 22 |
+
# Switch to non-root user
|
| 23 |
+
USER user
|
| 24 |
+
|
| 25 |
+
# Expose Ollama API port
|
| 26 |
EXPOSE 11434
|
| 27 |
|
| 28 |
+
# Start Ollama server
|
| 29 |
CMD ["ollama", "serve"]
|