Ezi Ozoani commited on
Commit
d57f2fb
1 Parent(s): f2a1f18

get 1 working

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