|
|
|
FROM ghcr.io/huggingface/text-generation-inference:1.3 as base |
|
|
|
COPY ./requirements.txt /code/requirements.txt |
|
|
|
|
|
RUN pip install jupyterlab jupyterlab-vim==0.15.1 jupyterlab-vimrc |
|
|
|
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt |
|
|
|
|
|
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/ |
|
|
|
|
|
RUN useradd -m -u 1000 -s /bin/bash user |
|
|
|
|
|
RUN mkdir /data && chown user:user /data |
|
|
|
|
|
USER user |
|
|
|
|
|
WORKDIR /home/user |
|
|
|
|
|
ENV PATH="/home/user/.local/bin:${PATH}" |
|
|
|
|
|
|
|
FROM base as sagemaker |
|
|
|
COPY sagemaker-entrypoint.sh entrypoint.sh |
|
RUN chmod +x entrypoint.sh |
|
|
|
ENTRYPOINT ["./entrypoint.sh"] |
|
|
|
|
|
FROM base |
|
|
|
|
|
ENTRYPOINT [] |
|
|
|
|
|
USER user |
|
|
|
|
|
WORKDIR /home/user |
|
|
|
|
|
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 --chown=user . $HOME/ |
|
|
|
|
|
RUN chmod +x $HOME/run.sh |
|
|
|
|
|
CMD ["/home/user/run.sh"] |