E-slam commited on
Commit
2157c74
·
verified ·
1 Parent(s): fc87760

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -4
Dockerfile CHANGED
@@ -1,16 +1,23 @@
1
  FROM python:3.9
2
 
3
- RUN useradd -m -u 1000 user
 
 
 
 
 
4
  USER user
5
 
6
  WORKDIR /code
7
 
 
8
  COPY ./requirements.txt /code/requirements.txt
 
9
 
10
- RUN chown -R user:user /code
11
-
12
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
13
 
 
14
  COPY --chown=user:user . /code
15
 
16
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.9
2
 
3
+ # Install sudo package
4
+ RUN apt-get update && apt-get install -y sudo
5
+
6
+ # Create user with UID 1000 and add to sudoers
7
+ RUN useradd -m -u 1000 user && echo "user ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
8
+
9
  USER user
10
 
11
  WORKDIR /code
12
 
13
+ # Copy requirements and set permissions
14
  COPY ./requirements.txt /code/requirements.txt
15
+ RUN sudo chown -R user:user /code
16
 
17
+ # Install dependencies
 
18
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
19
 
20
+ # Copy the rest of the application code and set permissions
21
  COPY --chown=user:user . /code
22
 
23
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]