File size: 1,944 Bytes
00d7f53 db451dd 00d7f53 ebd6146 57904d8 3901221 db451dd 3901221 db451dd 3901221 db451dd 3901221 db451dd 3901221 db451dd 3901221 db451dd c6296fc db451dd 3901221 db451dd 3901221 db451dd 3901221 db451dd 2074c9a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# Start from the TGI base image
FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
COPY ./requirements.txt /code/requirements.txt
RUN pip install -r /code/requirements.txt
## Install JupyterLab and plugins
#RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc
#
#RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
#
## Install Visual Studio Code CLI
#RUN curl -Lk 'https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64' \
# --output vscode_cli.tar.gz \
# && tar -xvf vscode_cli.tar.gz \
# && chmod +x ./code \
# && mv code /usr/local/bin/
#
## Create a non-root user with UID 1000
RUN useradd -m -u 1000 -s /bin/bash user
#
## Create the /data directory and set its ownership
RUN mkdir /data && chown user:user /data
#
## Switch to the non-root user
USER user
#
## Set working directory
WORKDIR /home/user
#
## Add local python bin directory to PATH
ENV PATH="/home/user/.local/bin:${PATH}"
#
## AWS Sagemaker compatible image
## Assuming this part remains the same from your original Dockerfile
#FROM base as sagemaker
#
#COPY sagemaker-entrypoint.sh entrypoint.sh
#RUN chmod +x entrypoint.sh
#
#ENTRYPOINT ["./entrypoint.sh"]
#
## Final image
#FROM base
#
## Override the ENTRYPOINT
ENTRYPOINT []
#
## Switch to the non-root user
USER user
#
## Set working directory
#WORKDIR /home/user
#
## Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1 \
GRADIO_ALLOW_FLAGGING=never \
GRADIO_NUM_PORTS=1 \
GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_THEME=huggingface \
SYSTEM=spaces
#
## Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/
#
## Ensure run.sh is executable
#RUN chmod +x $HOME/run.sh
#
## Set the CMD to run your script
#CMD ["/home/user/run.sh"]
CMD python /home/user/app.py |