|
1 | 1 | # BUILDER
|
2 |
| -FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 as builder |
| 2 | +FROM ubuntu:22.04 |
3 | 3 | WORKDIR /builder
|
4 | 4 | ARG TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6+PTX}"
|
5 | 5 | ARG BUILD_EXTENSIONS="${BUILD_EXTENSIONS:-}"
|
6 |
| -ARG BUILD_REQUIREMENTS="${BUILD_REQUIREMENTS:-requirements.txt}" |
7 | 6 | ARG APP_UID="${APP_UID:-6972}"
|
8 | 7 | ARG APP_GID="${APP_GID:-6972}"
|
9 |
| -# create / update build env |
10 |
| -RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw \ |
11 |
| - apt update && \ |
12 |
| - apt install --no-install-recommends -y git vim build-essential python3-dev pip && \ |
13 |
| - rm -rf /var/lib/apt/lists/* |
14 |
| -RUN --mount=type=cache,target=/root/.cache/pip,rw \ |
15 |
| - pip3 install --global --upgrade pip wheel setuptools && \ |
16 |
| - # make shared builder & runtime app user |
17 |
| - addgroup --gid $APP_GID app_grp && \ |
18 |
| - useradd -m -u $APP_UID --gid app_grp app |
19 |
| -USER app:app_grp |
20 |
| -# build wheels for runtime |
21 |
| -WORKDIR /home/app/build |
22 |
| -COPY --chown=app:app_grp "$BUILD_REQUIREMENTS" /home/app/build/requirements.txt |
23 |
| -COPY --chown=app:app_grp extensions /home/app/build/extensions |
24 |
| -RUN --mount=type=cache,target=/root/.cache/pip,rw \ |
25 |
| - # build all requirements files as wheel dists |
26 |
| - pip3 wheel -w wheels -r requirements.txt `echo "$BUILD_EXTENSIONS" | sed -r 's/([^,]+)\s*,?\s*/ -r \/home\/app\/build\/extensions\/\1\/requirements.txt/g'` |
27 |
| - # drop wheel and setuptools .whl to avoid install issues |
28 |
| -RUN rm wheels/setuptools*.whl |
29 | 8 |
|
30 |
| -# RUNTIME |
31 |
| -FROM nvidia/cuda:12.1.1-runtime-ubuntu22.04 |
32 |
| -ARG TORCH_CUDA_ARCH_LIST="${TORCH_CUDA_ARCH_LIST:-3.5;5.0;6.0;6.1;7.0;7.5;8.0;8.6}" |
33 |
| -ARG APP_UID="${APP_UID:-6972}" |
34 |
| -ARG APP_GID="${APP_GID:-6972}" |
35 |
| -ENV CLI_ARGS="" |
36 |
| -# create / update runtime env |
37 | 9 | RUN --mount=type=cache,target=/var/cache/apt,sharing=locked,rw \
|
38 | 10 | apt update && \
|
39 |
| - apt install --no-install-recommends -y git python3 pip && \ |
40 |
| - rm -rf /var/lib/apt/lists/* && \ |
41 |
| - pip3 install --global --no-cache --upgrade pip wheel setuptools && \ |
42 |
| - # make shared builder & runtime app user |
43 |
| - addgroup --gid $APP_GID app_grp && \ |
44 |
| - useradd -m -u $APP_UID --gid app_grp app |
45 |
| -USER app:app_grp |
46 |
| -# install locally built wheels for app |
47 |
| -WORKDIR /home/app/wheels |
48 |
| -COPY --from=builder /home/app/build/wheels /home/app/wheels |
49 |
| -COPY --chown=app:app_grp . /home/app/text-generation-webui |
50 |
| -RUN umask 0002 && \ |
51 |
| - chmod g+rwX /home/app/text-generation-webui && \ |
52 |
| - pip3 install --global --no-build-isolation --no-cache --no-index ./*.whl && \ |
53 |
| - rm -r /home/app/wheels |
| 11 | + apt install --no-install-recommends -y git vim build-essential python3-dev pip bash curl && \ |
| 12 | + rm -rf /var/lib/apt/lists/* |
| 13 | +WORKDIR /home/app/ |
| 14 | +RUN git clone https://github.com/oobabooga/text-generation-webui.git |
54 | 15 | WORKDIR /home/app/text-generation-webui
|
| 16 | +RUN GPU_CHOICE=A USE_CUDA118=FALSE LAUNCH_AFTER_INSTALL=FALSE INSTALL_EXTENSIONS=TRUE ./start_linux.sh --verbose |
| 17 | +COPY CMD_FLAGS.txt /home/app/text-generation-webui/ |
55 | 18 | EXPOSE ${CONTAINER_PORT:-7860} ${CONTAINER_API_PORT:-5000} ${CONTAINER_API_STREAM_PORT:-5005}
|
| 19 | +WORKDIR /home/app/text-generation-webui |
56 | 20 | # set umask to ensure group read / write at runtime
|
57 |
| -CMD umask 0002 && export HOME=/home/app && python3 server.py ${CLI_ARGS} |
| 21 | +CMD umask 0002 && export HOME=/home/app/text-generation-webui && ./start_linux.sh |
0 commit comments