derek-thomas HF staff commited on
Commit
6d3aa6a
1 Parent(s): 60b112e

Adding git

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -51
Dockerfile CHANGED
@@ -1,59 +1,32 @@
1
  # Start from the TGI base image
2
  FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
3
 
 
 
 
4
  COPY ./requirements.txt /code/requirements.txt
5
 
6
  RUN pip install -r /code/requirements.txt
7
 
8
- ## Install JupyterLab and plugins
9
- #RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
10
- #
11
- #RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
12
- #
13
- ## Install Visual Studio Code CLI
14
- #RUN curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' \
15
- # --output vscode_cli.tar.gz \
16
- # && tar -xvf vscode_cli.tar.gz \
17
- # && chmod +x ./code \
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
37
- #FROM base as sagemaker
38
- #
39
- #COPY sagemaker-entrypoint.sh entrypoint.sh
40
- #RUN chmod +x entrypoint.sh
41
- #
42
- #ENTRYPOINT ["./entrypoint.sh"]
43
- #
44
- ## Final image
45
- #FROM base
46
- #
47
- ## Override the ENTRYPOINT
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 \
@@ -63,13 +36,9 @@ ENV HOME=/home/user \
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
  CMD python /home/user/app.py
 
1
  # Start from the TGI base image
2
  FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
3
 
4
+ # Install git
5
+ RUN apt-get update && apt-get install -y git
6
+
7
  COPY ./requirements.txt /code/requirements.txt
8
 
9
  RUN pip install -r /code/requirements.txt
10
 
11
+ # Create a non-root user with UID 1000
 
 
 
 
 
 
 
 
 
 
 
 
12
  RUN useradd -m -u 1000 -s /bin/bash user
13
+
14
+ # Create the /data directory and set its ownership
15
  RUN mkdir /data && chown user:user /data
16
+
17
+ # Switch to the non-root user
18
  USER user
19
+
20
+ # Set working directory
21
  WORKDIR /home/user
22
+
23
+ # Add local python bin directory to PATH
24
  ENV PATH="/home/user/.local/bin:${PATH}"
25
+
26
+ # Override the ENTRYPOINT
 
 
 
 
 
 
 
 
 
 
 
 
27
  ENTRYPOINT []
28
+
29
+ # Set home to the user's home directory
 
 
 
 
 
 
30
  ENV HOME=/home/user \
31
  PATH=/home/user/.local/bin:$PATH \
32
  PYTHONPATH=$HOME/app \
 
36
  GRADIO_SERVER_NAME=0.0.0.0 \
37
  GRADIO_THEME=huggingface \
38
  SYSTEM=spaces
39
+
40
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
41
  COPY --chown=user . $HOME/
42
+
43
+ # Set the CMD to run your script
 
 
 
 
44
  CMD python /home/user/app.py