ikechan8370 commited on
Commit
2293487
1 Parent(s): ed29561

fix: permission

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -10
Dockerfile CHANGED
@@ -1,17 +1,19 @@
1
  FROM python:3.9
 
 
2
 
3
- WORKDIR /code
4
-
5
- ENV TRANSFORMERS_CACHE=/code/.cache
6
-
7
- RUN mkdir /code/.cache
8
-
9
- COPY ./requirements.txt /code/requirements.txt
10
 
11
  RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y -y
12
 
13
- RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
14
 
15
- COPY . /code
16
 
17
- CMD ["python", "/code/main.py"]
 
1
  FROM python:3.9
2
+ RUN useradd -m -u 1000 user
3
+ USER user
4
 
5
+ ENV HOME=/home/user \
6
+ PATH=/home/user/.local/bin:$PATH
7
+ WORKDIR $HOME/app
8
+ ENV TRANSFORMERS_CACHE=$HOME/app/.cache
9
+ ENV HUGGINGFACE_HUB_CACHE=$HOME/app/.cache
10
+ RUN chmod 777 $HOME/app/.cache
11
+ COPY ./requirements.txt $HOME/app/requirements.txt
12
 
13
  RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y -y
14
 
15
+ RUN pip install --no-cache-dir --upgrade -r $HOME/app/requirements.txt
16
 
17
+ COPY --chown=user . $HOME/app
18
 
19
+ CMD ["python", "$HOME/app/main.py"]