MingLi commited on
Commit
0167318
1 Parent(s): 83a9ef7

解决docker无用户问题

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -4
Dockerfile CHANGED
@@ -3,15 +3,21 @@
3
 
4
  FROM python:3.11
5
 
6
- WORKDIR /code
7
-
8
  RUN apt-get update && apt-get install -y \
9
  ffmpeg
10
 
11
- COPY ./requirements.txt /code/requirements.txt
 
 
 
 
 
 
 
 
12
 
13
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
14
 
15
- COPY . .
16
 
17
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
3
 
4
  FROM python:3.11
5
 
 
 
6
  RUN apt-get update && apt-get install -y \
7
  ffmpeg
8
 
9
+ RUN useradd -m -u 1000 user
10
+
11
+ USER user
12
+
13
+ WORKDIR /code
14
+
15
+ COPY --chown=user ./requirements.txt /code/requirements.txt
16
+
17
+ ENV PATH /home/user/.local/bin:${PATH}
18
 
19
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
20
 
21
+ COPY --chown=user . .
22
 
23
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]