Jirat Jaturanpinyo commited on
Commit
9da266c
·
verified ·
1 Parent(s): e8907e7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -7
Dockerfile CHANGED
@@ -1,14 +1,24 @@
1
- # Use the official Python 3.10.9 image
2
  FROM python:3.11.3
3
 
4
- # Copy the current directory contents into the container at .
5
- COPY . .
6
 
7
- # Set the working directory to /
8
- WORKDIR /voicevox_engine
 
9
 
10
- # Install requirements.txt
 
 
 
 
 
 
 
 
 
11
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
12
 
13
  # Start the FastAPI app on port 7860, the default port expected by Spaces
14
- CMD ["python", "run.py", "--voicevox_dir", "../linux-cpu","--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use the official Python 3.11.3 image
2
  FROM python:3.11.3
3
 
4
+ # Set up a new user named "user" with user ID 1000
5
+ RUN useradd -m -u 1000 user
6
 
7
+ # Set the home to the user's home directory and add user's local bin to PATH
8
+ ENV HOME=/home/user \
9
+ PATH=/home/user/.local/bin:$PATH
10
 
11
+ # Switch to the "user" user
12
+ USER user
13
+
14
+ # Create the app directory
15
+ WORKDIR $HOME/app
16
+
17
+ # Copy the current directory contents into the container at $HOME/app and set the owner to the user
18
+ COPY --chown=user . $HOME/app
19
+
20
+ # Install requirements.txt
21
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
22
 
23
  # Start the FastAPI app on port 7860, the default port expected by Spaces
24
+ CMD ["python", "run.py", "--voicevox_dir", "../linux-cpu", "--host", "0.0.0.0", "--port", "7860"]