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

refactor: reorganize Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -23
Dockerfile CHANGED
@@ -1,40 +1,32 @@
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 \
25
  pytorch torchvision torchaudio pytorch-cuda=12.1 \
26
  faiss-gpu=1.9.0 && \
27
- conda clean -afy
 
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
39
 
40
  CMD ["python", "main.py"]
 
1
  FROM continuumio/miniconda3
 
2
 
3
+ WORKDIR /code
4
  COPY ./requirements.txt /code/requirements.txt
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  RUN conda install -y \
7
  -c pytorch -c nvidia \
8
  python=3.10 \
9
  pytorch torchvision torchaudio pytorch-cuda=12.1 \
10
  faiss-gpu=1.9.0 && \
11
+ conda clean -afy && \
12
+ pip install --no-cache-dir -r /code/requirements.txt
13
 
14
+ RUN useradd -m -u 1000 user
15
+ USER user
16
 
17
+ ENV HOME=/home/user \
18
+ PATH=/home/user/.local/bin:$PATH \
19
+ PYTHONPATH=$HOME/app \
20
+ PYTHONUNBUFFERED=1 \
21
+ GRADIO_ALLOW_FLAGGING=never \
22
+ GRADIO_NUM_PORTS=1 \
23
+ GRADIO_SERVER_NAME=0.0.0.0 \
24
+ GRADIO_THEME=huggingface \
25
+ SYSTEM=spaces
26
 
27
+ WORKDIR $HOME/app
28
  COPY --chown=user . $HOME/app
29
 
 
30
  EXPOSE 7860
31
 
32
  CMD ["python", "main.py"]