YuITC commited on
Commit
a19e26c
·
1 Parent(s): b4ad7cb

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -5
Dockerfile CHANGED
@@ -1,10 +1,24 @@
1
  FROM continuumio/miniconda3
 
2
 
3
- WORKDIR /app
4
 
5
- # Get dependencies
6
- COPY requirements.txt .
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  RUN conda install -y \
9
  -c pytorch -c nvidia \
10
  python=3.10 \
@@ -14,8 +28,11 @@ RUN conda install -y \
14
 
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
- # Copy the rest of the code
18
- COPY . /app
 
 
 
19
 
20
  # Run the application
21
  EXPOSE 7860
 
1
  FROM continuumio/miniconda3
2
+ WORKDIR /code
3
 
4
+ COPY ./requirements.txt /code/requirements.txt
5
 
6
+ # Set up a new user named "user" with user ID 1000
7
+ RUN useradd -m -u 1000 user
8
+ USER user
9
 
10
+ # Set home to the user's home directory
11
+ ENV HOME=/home/user \
12
+ PATH=/home/user/.local/bin:$PATH \
13
+ PYTHONPATH=$HOME/app \
14
+ PYTHONUNBUFFERED=1 \
15
+ GRADIO_ALLOW_FLAGGING=never \
16
+ GRADIO_NUM_PORTS=1 \
17
+ GRADIO_SERVER_NAME=0.0.0.0 \
18
+ GRADIO_THEME=huggingface \
19
+ SYSTEM=spaces
20
+
21
+ # Install dependencies
22
  RUN conda install -y \
23
  -c pytorch -c nvidia \
24
  python=3.10 \
 
28
 
29
  RUN pip install --no-cache-dir -r requirements.txt
30
 
31
+ # Set the working directory to the user's home directory
32
+ WORKDIR $HOME/app
33
+
34
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
35
+ COPY --chown=user . $HOME/app
36
 
37
  # Run the application
38
  EXPOSE 7860