derek-thomas HF staff commited on
Commit
3901221
1 Parent(s): db451dd

Fixing user issues

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -17
Dockerfile CHANGED
@@ -3,6 +3,8 @@ FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
3
 
4
  COPY ./requirements.txt /code/requirements.txt
5
 
 
 
6
  ## Install JupyterLab and plugins
7
  #RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
8
  #
@@ -16,19 +18,19 @@ COPY ./requirements.txt /code/requirements.txt
16
  # && mv code /usr/local/bin/
17
  #
18
  ## Create a non-root user with UID 1000
19
- #RUN useradd -m -u 1000 -s /bin/bash user
20
  #
21
  ## Create the /data directory and set its ownership
22
- #RUN mkdir /data && chown user:user /data
23
  #
24
  ## Switch to the non-root user
25
- #USER user
26
  #
27
  ## Set working directory
28
- #WORKDIR /home/user
29
  #
30
  ## Add local python bin directory to PATH
31
- #ENV PATH="/home/user/.local/bin:${PATH}"
32
  #
33
  ## AWS Sagemaker compatible image
34
  ## Assuming this part remains the same from your original Dockerfile
@@ -46,28 +48,28 @@ COPY ./requirements.txt /code/requirements.txt
46
  #ENTRYPOINT []
47
  #
48
  ## Switch to the non-root user
49
- #USER user
50
  #
51
  ## Set working directory
52
  #WORKDIR /home/user
53
  #
54
  ## Set home to the user's home directory
55
- #ENV HOME=/home/user \
56
- # PATH=/home/user/.local/bin:$PATH \
57
- # PYTHONPATH=$HOME/app \
58
- # PYTHONUNBUFFERED=1 \
59
- # GRADIO_ALLOW_FLAGGING=never \
60
- # GRADIO_NUM_PORTS=1 \
61
- # GRADIO_SERVER_NAME=0.0.0.0 \
62
- # GRADIO_THEME=huggingface \
63
- # SYSTEM=spaces
64
  #
65
  ## Copy the current directory contents into the container at $HOME/app setting the owner to the user
66
- #COPY --chown=user . $HOME/
67
  #
68
  ## Ensure run.sh is executable
69
  #RUN chmod +x $HOME/run.sh
70
  #
71
  ## Set the CMD to run your script
72
  #CMD ["/home/user/run.sh"]
73
- python app.py
 
3
 
4
  COPY ./requirements.txt /code/requirements.txt
5
 
6
+ RUN pip install /code/requirements.txt
7
+
8
  ## Install JupyterLab and plugins
9
  #RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
10
  #
 
18
  # && mv code /usr/local/bin/
19
  #
20
  ## Create a non-root user with UID 1000
21
+ RUN useradd -m -u 1000 -s /bin/bash user
22
  #
23
  ## Create the /data directory and set its ownership
24
+ RUN mkdir /data && chown user:user /data
25
  #
26
  ## Switch to the non-root user
27
+ USER user
28
  #
29
  ## Set working directory
30
+ WORKDIR /home/user
31
  #
32
  ## Add local python bin directory to PATH
33
+ ENV PATH="/home/user/.local/bin:${PATH}"
34
  #
35
  ## AWS Sagemaker compatible image
36
  ## Assuming this part remains the same from your original Dockerfile
 
48
  #ENTRYPOINT []
49
  #
50
  ## Switch to the non-root user
51
+ USER user
52
  #
53
  ## Set working directory
54
  #WORKDIR /home/user
55
  #
56
  ## Set home to the user's home directory
57
+ ENV HOME=/home/user \
58
+ PATH=/home/user/.local/bin:$PATH \
59
+ PYTHONPATH=$HOME/app \
60
+ PYTHONUNBUFFERED=1 \
61
+ GRADIO_ALLOW_FLAGGING=never \
62
+ GRADIO_NUM_PORTS=1 \
63
+ GRADIO_SERVER_NAME=0.0.0.0 \
64
+ GRADIO_THEME=huggingface \
65
+ SYSTEM=spaces
66
  #
67
  ## Copy the current directory contents into the container at $HOME/app setting the owner to the user
68
+ COPY --chown=user . $HOME/
69
  #
70
  ## Ensure run.sh is executable
71
  #RUN chmod +x $HOME/run.sh
72
  #
73
  ## Set the CMD to run your script
74
  #CMD ["/home/user/run.sh"]
75
+ python /home/user/app.py