myyim commited on
Commit
33802ae
·
verified ·
1 Parent(s): 5dde0f2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -19
Dockerfile CHANGED
@@ -1,27 +1,30 @@
1
- # Use the official Python 3.9 image
2
- FROM python:3.9
3
 
4
- # Set the working directory to /code
5
- WORKDIR /code
6
 
7
- # Copy the current directory contents into the container at /code
8
- COPY ./requirements.txt /code/requirements.txt
9
 
10
- # Install requirements.txt
11
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
 
12
 
13
- # Set up a new user named "user" with user ID 1000
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
- # Set the working directory to the user's home directory
22
- WORKDIR $HOME/app
 
 
 
23
 
24
- # Copy the current directory contents into the container at $HOME/app setting the owner to the user
25
- COPY --chown=user . $HOME/app
26
 
27
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
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"]