Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +22 -19
Dockerfile
CHANGED
|
@@ -1,27 +1,30 @@
|
|
| 1 |
-
#
|
| 2 |
-
FROM
|
| 3 |
|
| 4 |
-
#
|
| 5 |
-
|
| 6 |
|
| 7 |
-
#
|
| 8 |
-
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
|
|
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
RUN useradd -m -u 1000 user
|
| 15 |
-
# Switch to the "user" user
|
| 16 |
USER user
|
| 17 |
-
# Set home to the user's home directory
|
| 18 |
-
ENV HOME=/home/user \
|
| 19 |
-
PATH=/home/user/.local/bin:$PATH
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
# Switch to the non-root user
|
|
|
|
|
|
|
| 15 |
USER user
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
+
# Copy the entrypoint script before switching users
|
| 18 |
+
# COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
| 19 |
+
COPY requirements.txt $HOME/requirements.txt
|
| 20 |
+
COPY profile.png $HOME/profile.png
|
| 21 |
+
COPY entrypoint.sh $HOME/entrypoint.sh
|
| 22 |
|
| 23 |
+
# Ensure the user has access to the directory
|
| 24 |
+
RUN mkdir -p $HOME/.ollama && chown -R user:user $HOME/.ollama
|
| 25 |
|
| 26 |
+
# Install netcat (nc) for checking server readiness
|
| 27 |
+
# RUN apt-get update && apt-get install -y netcat
|
| 28 |
+
RUN pip3 install -r requirements.txt
|
| 29 |
+
|
| 30 |
+
ENTRYPOINT ["entrypoint.sh"]
|