| |
| |
| |
|
|
| FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 AS base |
|
|
| |
| FROM base AS builder |
|
|
| |
| RUN apt update && apt install -y gcc-11 g++-11 cpp-11 jq xsel curl gnupg make python3-dev && curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt install nodejs -y && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \ |
| --slave /usr/bin/g++ g++ /usr/bin/g++-11 \ |
| --slave /usr/bin/gcov gcov /usr/bin/gcov-11 \ |
| --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \ |
| --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 && \ |
| update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-11 110 |
|
|
| RUN npm install -g yarn |
|
|
| WORKDIR /app |
|
|
| |
| COPY . ./ |
|
|
| RUN export NITRO_VERSION=$(cat extensions/inference-nitro-extension/bin/version.txt) && \ |
| jq --arg nitroVersion $NITRO_VERSION '(.scripts."downloadnitro:linux" | gsub("\\${NITRO_VERSION}"; $nitroVersion)) | gsub("\r"; "")' extensions/inference-nitro-extension/package.json > /tmp/newcommand.txt && export NEW_COMMAND=$(sed 's/^"//;s/"$//' /tmp/newcommand.txt) && jq --arg newCommand "$NEW_COMMAND" '.scripts."downloadnitro:linux" = $newCommand' extensions/inference-nitro-extension/package.json > /tmp/package.json && mv /tmp/package.json extensions/inference-nitro-extension/package.json |
| RUN make install-and-build |
|
|
| |
| FROM base AS runner |
|
|
| |
| RUN apt update && apt install -y gcc-11 g++-11 cpp-11 jq xsel curl gnupg make python3-dev && curl -sL https://deb.nodesource.com/setup_20.x | bash - && apt-get install nodejs -y && rm -rf /var/lib/apt/lists/* |
|
|
| |
| RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 110 \ |
| --slave /usr/bin/g++ g++ /usr/bin/g++-11 \ |
| --slave /usr/bin/gcov gcov /usr/bin/gcov-11 \ |
| --slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \ |
| --slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11 && \ |
| update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-11 110 |
|
|
| RUN npm install -g yarn |
|
|
| WORKDIR /app |
|
|
| |
| COPY --from=builder /app/package.json ./package.json |
| COPY --from=builder /app/node_modules ./node_modules/ |
| COPY --from=builder /app/yarn.lock ./yarn.lock |
|
|
| |
| COPY --from=builder /app/core ./core/ |
| COPY --from=builder /app/server ./server/ |
| RUN cd core && yarn install && yarn run build |
| RUN yarn workspace @janhq/server install && yarn workspace @janhq/server build |
| COPY --from=builder /app/docs/openapi ./docs/openapi/ |
|
|
| |
| COPY --from=builder /app/pre-install ./pre-install/ |
|
|
| |
| COPY --from=builder /app/joi ./joi/ |
| COPY --from=builder /app/web ./web/ |
|
|
| RUN yarn workspace @janhq/joi install && yarn workspace @janhq/joi build |
| RUN yarn workspace @janhq/web install |
|
|
| RUN npm install -g serve@latest |
|
|
| EXPOSE 1337 3000 3928 |
|
|
| ENV LD_LIBRARY_PATH=/usr/local/cuda/targets/x86_64-linux/lib:/usr/local/cuda-12.0/compat${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} |
|
|
| ENV JAN_API_HOST 0.0.0.0 |
| ENV JAN_API_PORT 1337 |
|
|
| ENV API_BASE_URL http://localhost:1337 |
|
|
| CMD ["sh", "-c", "export NODE_ENV=production && yarn workspace @janhq/web build && cd web && npx serve out & cd server && node build/main.js"] |
|
|
| |
| |
| |
|
|