Mintplex-Labs / anything-llm

The all-in-one Desktop & Docker AI application with full RAG and AI Agent capabilities.
https://useanything.com
MIT License
14.37k stars 1.49k forks source link

[BUG]: Docker Vite Build Segmentation Fault on macOS #1290

Closed jmstacey closed 1 week ago

jmstacey commented 1 week ago

How are you running AnythingLLM?

Docker (local)

What happened?

Tried installing Docker as described in readme, both the simplified and build from source method. Segmentation fault with yarn when trying to build Vite. Host is iMac (Intel) running macOS 14.4.1 with Docker Desktop 4.29.0

➜  docker git:(master) docker compose up -d --build                  
WARN[0000] /Users/jon/Sites/anything-llm/docker/docker-compose.yml: `version` is obsolete 
[+] Building 89.6s (24/37)                                                                                              docker:desktop-linux
 => [anything-llm internal] load build definition from Dockerfile                                                                       0.0s
 => => transferring dockerfile: 7.21kB                                                                                                  0.0s
 => [anything-llm internal] load metadata for docker.io/library/ubuntu:jammy-20230916                                                   1.4s
 => [anything-llm internal] load .dockerignore                                                                                          0.0s
 => => transferring context: 418B                                                                                                       0.0s
 => [anything-llm base 1/1] FROM docker.io/library/ubuntu:jammy-20230916@sha256:9b8dec3bf938bc80fbe758d856e96fdfab5f56c39d44b0cff351e8  0.0s
 => => resolve docker.io/library/ubuntu:jammy-20230916@sha256:9b8dec3bf938bc80fbe758d856e96fdfab5f56c39d44b0cff351e847bb1b01ea          0.0s
 => => sha256:9b8dec3bf938bc80fbe758d856e96fdfab5f56c39d44b0cff351e847bb1b01ea 1.13kB / 1.13kB                                          0.0s
 => => sha256:b4b521bfcec90b11d2869e00fe1f2380c21cbfcd799ee35df8bd7ac09e6f63ea 424B / 424B                                              0.0s
 => => sha256:3565a89d9e81a4cb4cb2b0d947c7c11227a3f358dc216d19fc54bfd77cd5b542 2.30kB / 2.30kB                                          0.0s
 => [anything-llm internal] load build context                                                                                          0.1s
 => => transferring context: 4.82MB                                                                                                     0.1s
 => [anything-llm build-amd64 1/7] RUN echo "Preparing build of AnythingLLM image for non-ARM architecture"                             0.3s
 => [anything-llm build-amd64 2/7] RUN DEBIAN_FRONTEND=noninteractive apt-get update &&     DEBIAN_FRONTEND=noninteractive apt-get in  40.5s
 => [anything-llm build-amd64 3/7] RUN groupadd -g "1000" anythingllm &&     useradd -l -u "1000" -m -d /app -s /bin/bash -g anythingl  0.2s 
 => [anything-llm build-amd64 4/7] COPY ./docker/docker-entrypoint.sh /usr/local/bin/                                                   0.2s 
 => [anything-llm build-amd64 5/7] COPY ./docker/docker-healthcheck.sh /usr/local/bin/                                                  0.0s 
 => [anything-llm build-amd64 6/7] COPY --chown=anythingllm:anythingllm ./docker/.env.example /app/server/.env                          0.0s 
 => [anything-llm build-amd64 7/7] RUN chmod +x /usr/local/bin/docker-entrypoint.sh &&     chmod +x /usr/local/bin/docker-healthcheck.  0.2s 
 => [anything-llm build 1/2] RUN echo "Running common build flow of AnythingLLM image for all architectures"                            0.2s 
 => [anything-llm build 2/2] WORKDIR /app                                                                                               0.0s
 => [anything-llm server-deps 1/7] COPY ./server/package.json ./server/yarn.lock ./server/                                              0.0s
 => [anything-llm frontend-deps 1/4] COPY ./frontend/package.json ./frontend/yarn.lock ./frontend/                                      0.0s
 => [anything-llm server-deps 2/7] WORKDIR /app/server                                                                                  0.0s
 => [anything-llm frontend-deps 2/4] WORKDIR /app/frontend                                                                              0.0s
 => CANCELED [anything-llm server-deps 3/7] RUN yarn install --production --network-timeout 100000 && yarn cache clean                 46.3s
 => [anything-llm frontend-deps 3/4] RUN yarn install --network-timeout 100000 && yarn cache clean                                     44.6s
 => [anything-llm frontend-deps 4/4] WORKDIR /app                                                                                       0.1s
 => [anything-llm build-stage 1/4] COPY ./frontend/ ./frontend/                                                                         0.1s
 => [anything-llm build-stage 2/4] WORKDIR /app/frontend                                                                                0.0s
 => ERROR [anything-llm build-stage 3/4] RUN yarn build && yarn cache clean                                                             0.7s
------
 > [anything-llm build-stage 3/4] RUN yarn build && yarn cache clean:
0.374 yarn run v1.22.19
0.399 $ vite build
0.476 Segmentation fault
0.485 error Command failed with exit code 139.
0.485 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
------
failed to solve: process "/bin/bash -o pipefail -c yarn build && yarn cache clean" did not complete successfully: exit code: 139
➜  docker git:(master) 

Are there known steps to reproduce?

Follow instructions on https://github.com/Mintplex-Labs/anything-llm/blob/master/docker/HOW_TO_USE_DOCKER.md

git clone this repo and cd anything-llm to get to the root directory. touch server/storage/anythingllm.db to create empty SQLite DB file. cd docker/ cp .env.example .env you must do this before building docker-compose up -d --build to build the image - this will take a few moments.

timothycarambat commented 1 week ago

No related to code we wrote - seems to be an odd thing people encounter but our builds are completing, so if this was a systemic thing resulting from the code-change we made we would see on everything. We local dev on mac as well https://github.com/vitest-dev/vitest/issues/317

jmstacey commented 1 week ago

For anyone else who runs into this issue, the fix was released in Docker v4.30.0 and is applicable with Docker run on x86_64 macOS.