Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +37 -13
Dockerfile
CHANGED
@@ -1,32 +1,56 @@
|
|
|
|
1 |
FROM ollama/ollama:latest
|
2 |
|
3 |
-
#
|
4 |
-
RUN
|
|
|
|
|
|
|
5 |
|
6 |
# Set the home directory
|
7 |
-
ENV HOME=/home/
|
8 |
-
WORKDIR $HOME
|
|
|
|
|
|
|
9 |
|
10 |
# Ensure the user has access to the directory
|
11 |
-
RUN mkdir -p $HOME/.ollama && chown -R
|
12 |
|
13 |
# Install netcat (nc) for checking server readiness
|
14 |
-
RUN apt-get update && apt-get install -y netcat
|
15 |
|
16 |
# Copy the entrypoint script before switching users
|
17 |
-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
18 |
|
19 |
# Set permissions for the entrypoint script
|
20 |
-
RUN chmod +x /usr/local/bin/entrypoint.sh
|
21 |
|
22 |
# Switch to the non-root user
|
23 |
-
USER
|
24 |
|
25 |
# Set Ollama to listen on all network interfaces
|
26 |
-
ENV OLLAMA_HOST=0.0.0.0:7860
|
27 |
|
28 |
# Expose the default port
|
29 |
-
EXPOSE 7860
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
-
# Use the custom entrypoint script
|
32 |
-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
1 |
+
# Specify the base Docker image
|
2 |
FROM ollama/ollama:latest
|
3 |
|
4 |
+
# Install Python 3 and its package manager
|
5 |
+
RUN apt-get update && apt-get install -y python3 python3-pip
|
6 |
+
|
7 |
+
# Create the user's home directory
|
8 |
+
# RUN useradd -ms /bin/bash user
|
9 |
|
10 |
# Set the home directory
|
11 |
+
# ENV HOME=/home/user
|
12 |
+
# WORKDIR $HOME
|
13 |
+
|
14 |
+
# Set the working directory inside the container
|
15 |
+
WORKDIR /app
|
16 |
|
17 |
# Ensure the user has access to the directory
|
18 |
+
RUN mkdir -p $HOME/.ollama && chown -R user:user $HOME/.ollama
|
19 |
|
20 |
# Install netcat (nc) for checking server readiness
|
21 |
+
# RUN apt-get update && apt-get install -y netcat
|
22 |
|
23 |
# Copy the entrypoint script before switching users
|
24 |
+
# COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
25 |
|
26 |
# Set permissions for the entrypoint script
|
27 |
+
# RUN chmod +x /usr/local/bin/entrypoint.sh
|
28 |
|
29 |
# Switch to the non-root user
|
30 |
+
USER user
|
31 |
|
32 |
# Set Ollama to listen on all network interfaces
|
33 |
+
# ENV OLLAMA_HOST=0.0.0.0:7860
|
34 |
|
35 |
# Expose the default port
|
36 |
+
# EXPOSE 7860
|
37 |
+
|
38 |
+
CMD ["ollama serve" & "ollama pull gemma3:4b" & "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
39 |
+
|
40 |
+
# Wait for the server to be ready
|
41 |
+
# while ! nc -z localhost 7860; do
|
42 |
+
# echo "Waiting for Ollama server to start..."
|
43 |
+
# sleep 1
|
44 |
+
# done
|
45 |
+
|
46 |
+
# Pull the model
|
47 |
+
# echo "Pulling the model..."
|
48 |
+
# ollama pull gemma3:4b
|
49 |
+
|
50 |
+
# Keep the container running
|
51 |
+
# wait
|
52 |
+
|
53 |
+
# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
54 |
|
55 |
+
# # Use the custom entrypoint script
|
56 |
+
# ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|