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

Update Dockerfile

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