derek-thomas HF staff commited on
Commit
96e1736
·
1 Parent(s): 7347470

Trying with weak permissions

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -6
Dockerfile CHANGED
@@ -1,12 +1,20 @@
1
  # Start from the TGI base image
2
  FROM ghcr.io/huggingface/text-generation-inference:1.3 as base
3
 
4
- # Install JupyterLab
5
- # Note: Ensure Python is installed in the base image. If not, you will need to install it.
6
- RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
 
 
 
 
 
 
 
 
7
 
8
  # Copy any necessary files (if needed)
9
- # COPY your-files /your-destination
10
 
11
  # AWS Sagemaker compatible image
12
  # Assuming this part remains the same from your original Dockerfile
@@ -20,9 +28,15 @@ ENTRYPOINT ["./entrypoint.sh"]
20
  # Final image
21
  FROM base
22
 
 
 
 
 
 
 
23
  # Add JupyterLab entrypoint
24
- # Note: You can customize the command to suit your needs
25
- ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--NotebookApp.token='' --port 7860"]
26
 
27
  # Optional: Set CMD to launch TGI or any other command
28
  #CMD ["text-generation-launcher", "--json-output"]
 
1
  # Start from the TGI base image
2
  FROM ghcr.io/huggingface/text-generation-inference:1.3 as base
3
 
4
+ # Create a non-root user with UID 1000
5
+ RUN useradd -m -u 1000 -s /bin/bash jupyteruser
6
+
7
+ # Switch to the non-root user
8
+ USER jupyteruser
9
+
10
+ # Set working directory
11
+ WORKDIR /home/jupyteruser
12
+
13
+ # Install JupyterLab and plugins
14
+ RUN pip install --user jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
15
 
16
  # Copy any necessary files (if needed)
17
+ # COPY --chown=jupyteruser:jupyteruser your-files /home/jupyteruser/your-destination
18
 
19
  # AWS Sagemaker compatible image
20
  # Assuming this part remains the same from your original Dockerfile
 
28
  # Final image
29
  FROM base
30
 
31
+ # Switch to the non-root user
32
+ USER jupyteruser
33
+
34
+ # Set working directory
35
+ WORKDIR /home/jupyteruser
36
+
37
  # Add JupyterLab entrypoint
38
+ # Note: Removed '--allow-root' as we're not running as root
39
+ ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--NotebookApp.token='' --port 7860"]
40
 
41
  # Optional: Set CMD to launch TGI or any other command
42
  #CMD ["text-generation-launcher", "--json-output"]