Spaces:
Sleeping
Sleeping
Commit
•
ebd6146
1
Parent(s):
a3e5109
Trying with code instead
Browse files- Dockerfile +35 -11
Dockerfile
CHANGED
@@ -1,23 +1,33 @@
|
|
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
|
6 |
|
7 |
# Switch to the non-root user
|
8 |
-
USER
|
9 |
|
10 |
# Set working directory
|
11 |
-
WORKDIR /home/
|
12 |
|
13 |
# Install JupyterLab and plugins
|
14 |
RUN pip install --user jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
|
15 |
|
16 |
# Add local python bin directory to PATH
|
17 |
-
ENV PATH="/home/
|
18 |
|
19 |
# Copy any necessary files (if needed)
|
20 |
-
# COPY --chown=
|
21 |
|
22 |
# AWS Sagemaker compatible image
|
23 |
# Assuming this part remains the same from your original Dockerfile
|
@@ -32,16 +42,30 @@ ENTRYPOINT ["./entrypoint.sh"]
|
|
32 |
FROM base
|
33 |
|
34 |
# Switch to the non-root user
|
35 |
-
USER
|
36 |
|
37 |
# Set working directory
|
38 |
-
WORKDIR /home/
|
39 |
|
40 |
-
#
|
41 |
-
ENV
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--NotebookApp.token=''", "--port", "7860", "--no-browser"]
|
45 |
|
46 |
# Optional: Set CMD to launch TGI or any other command
|
47 |
#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 |
+
COPY ./requirements.txt /code/requirements.txt
|
5 |
+
|
6 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
7 |
+
|
8 |
+
RUN curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' \
|
9 |
+
--output vscode_cli.tar.gz \
|
10 |
+
&& tar -xvf vscode_cli.tar.gz \
|
11 |
+
&& chmod +x ./code \
|
12 |
+
&& cp code /usr/local/bin/code \
|
13 |
+
|
14 |
# Create a non-root user with UID 1000
|
15 |
+
RUN useradd -m -u 1000 -s /bin/bash user
|
16 |
|
17 |
# Switch to the non-root user
|
18 |
+
USER user
|
19 |
|
20 |
# Set working directory
|
21 |
+
WORKDIR /home/user
|
22 |
|
23 |
# Install JupyterLab and plugins
|
24 |
RUN pip install --user jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
|
25 |
|
26 |
# Add local python bin directory to PATH
|
27 |
+
ENV PATH="/home/user/.local/bin:${PATH}"
|
28 |
|
29 |
# Copy any necessary files (if needed)
|
30 |
+
# COPY --chown=user:user your-files /home/user/your-destination
|
31 |
|
32 |
# AWS Sagemaker compatible image
|
33 |
# Assuming this part remains the same from your original Dockerfile
|
|
|
42 |
FROM base
|
43 |
|
44 |
# Switch to the non-root user
|
45 |
+
USER user
|
46 |
|
47 |
# Set working directory
|
48 |
+
WORKDIR /home/user
|
49 |
|
50 |
+
# Set home to the user's home directory
|
51 |
+
ENV HOME=/home/user \
|
52 |
+
PATH=/home/user/.local/bin:$PATH \
|
53 |
+
PYTHONPATH=$HOME/app \
|
54 |
+
PYTHONUNBUFFERED=1 \
|
55 |
+
GRADIO_ALLOW_FLAGGING=never \
|
56 |
+
GRADIO_NUM_PORTS=1 \
|
57 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
58 |
+
GRADIO_THEME=huggingface \
|
59 |
+
SYSTEM=spaces
|
60 |
|
61 |
+
## Add JupyterLab entrypoint
|
62 |
+
#ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--NotebookApp.token=''", "--port", "7860", "--no-browser"]
|
63 |
|
64 |
# Optional: Set CMD to launch TGI or any other command
|
65 |
#CMD ["text-generation-launcher", "--json-output"]
|
66 |
+
|
67 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
68 |
+
COPY --chown=user . $HOME/app
|
69 |
+
|
70 |
+
# RUN chmod +x run.sh
|
71 |
+
CMD ["./run.sh"]
|