Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -15
Dockerfile
CHANGED
@@ -1,35 +1,36 @@
|
|
1 |
# Use the latest version of the ollama image
|
2 |
FROM ollama/ollama:latest
|
3 |
|
4 |
-
#
|
5 |
-
# The base image is Debian-based, so it's better to run as root for package installation
|
6 |
USER root
|
|
|
|
|
7 |
RUN apt-get update && \
|
8 |
apt-get install -y curl && \
|
9 |
apt-get clean && \
|
10 |
rm -rf /var/lib/apt/lists/*
|
11 |
|
12 |
-
#
|
13 |
-
# The
|
14 |
-
|
15 |
-
|
|
|
|
|
|
|
16 |
OLLAMA_HOST=0.0.0.0 \
|
17 |
OLLAMA_ORIGINS=*
|
18 |
|
19 |
# Set the working directory
|
20 |
-
WORKDIR
|
21 |
|
22 |
-
# Copy
|
23 |
-
COPY --chown=
|
24 |
|
25 |
# Make the entrypoint script executable
|
26 |
-
RUN chmod +x
|
27 |
-
|
28 |
-
# ADDED: Ensure the ollama user owns its home directory and all contents
|
29 |
-
RUN chown -R ollama:ollama /home/ollama
|
30 |
|
31 |
-
# Switch to the non-root user
|
32 |
-
USER
|
33 |
|
34 |
# Expose the port for the Ollama server
|
35 |
EXPOSE 11434
|
|
|
1 |
# Use the latest version of the ollama image
|
2 |
FROM ollama/ollama:latest
|
3 |
|
4 |
+
# Switch to root to perform admin tasks
|
|
|
5 |
USER root
|
6 |
+
|
7 |
+
# Install curl
|
8 |
RUN apt-get update && \
|
9 |
apt-get install -y curl && \
|
10 |
apt-get clean && \
|
11 |
rm -rf /var/lib/apt/lists/*
|
12 |
|
13 |
+
# Create a dedicated directory for our app.
|
14 |
+
# The user that runs ollama is UID 1000. We will use that.
|
15 |
+
RUN mkdir -p /app
|
16 |
+
|
17 |
+
# Set environment variables
|
18 |
+
ENV HOME=/app \
|
19 |
+
PATH=/app/.local/bin:$PATH \
|
20 |
OLLAMA_HOST=0.0.0.0 \
|
21 |
OLLAMA_ORIGINS=*
|
22 |
|
23 |
# Set the working directory
|
24 |
+
WORKDIR /app
|
25 |
|
26 |
+
# Copy the entrypoint script and set ownership using the UID and GID
|
27 |
+
COPY --chown=1000:1000 entrypoint.sh .
|
28 |
|
29 |
# Make the entrypoint script executable
|
30 |
+
RUN chmod +x entrypoint.sh
|
|
|
|
|
|
|
31 |
|
32 |
+
# Switch to the non-root user by its UID
|
33 |
+
USER 1000
|
34 |
|
35 |
# Expose the port for the Ollama server
|
36 |
EXPOSE 11434
|