File size: 1,114 Bytes
00d7f53 db451dd 00d7f53 6d3aa6a ebd6146 57904d8 3901221 6d3aa6a 3901221 6d3aa6a 3901221 6d3aa6a 3901221 6d3aa6a 3901221 6d3aa6a 3901221 6d3aa6a c6296fc 6d3aa6a 3901221 6d3aa6a 3901221 6d3aa6a 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 |
# Start from the TGI base image
FROM ghcr.io/huggingface/text-generation-inference:2.0 as base
# Install git
RUN apt-get update && apt-get install -y git
COPY ./requirements.txt /code/requirements.txt
RUN pip install -r /code/requirements.txt
# 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}"
# Override the ENTRYPOINT
ENTRYPOINT []
# 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/
# Set the CMD to run your script
CMD python /home/user/app.py |