Spaces:
Sleeping
Sleeping
File size: 1,822 Bytes
00d7f53 c349f19 00d7f53 ebd6146 ca0ed6f ebd6146 3cbdcd2 ebd6146 3cbdcd2 ebd6146 96e1736 ebd6146 96e1736 04d2dbd 8f70d13 96e1736 ebd6146 96e1736 ebd6146 96e1736 a9e8ff1 ebd6146 a9e8ff1 00d7f53 ff609c0 96e1736 ebd6146 96e1736 ebd6146 96e1736 ebd6146 a9e8ff1 ebd6146 a63a7e9 ebd6146 cb587cd a63a7e9 cb587cd a63a7e9 |
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 |
# Start from the TGI base image
FROM ghcr.io/huggingface/text-generation-inference:1.3 as base
COPY ./requirements.txt /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"] |