这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b1f0ced
Update build process
timothycarambat Jan 5, 2024
477c07b
temp only build AMD64
timothycarambat Jan 5, 2024
bab7fa6
increase yarn install timeout during ARM build - keeps timing out?
timothycarambat Jan 5, 2024
e5e7fa5
wip monkey patch for ARM chromium
timothycarambat Jan 5, 2024
57c56a8
WIP arm64 chromedriver dockerfile
shatfield4 Jan 6, 2024
abec5ab
update buildfiles per-arch
timothycarambat Jan 6, 2024
8692cdd
update build files
timothycarambat Jan 6, 2024
b9b6ba8
force arg for arm64
timothycarambat Jan 6, 2024
6d5ffae
wip
timothycarambat Jan 6, 2024
28331cb
combine jobs into runner
timothycarambat Jan 6, 2024
e54af8b
test build
timothycarambat Jan 6, 2024
c7da319
bump
timothycarambat Jan 6, 2024
68d6b7d
bump
timothycarambat Jan 6, 2024
22a2543
bump
timothycarambat Jan 6, 2024
c1394ee
wip
timothycarambat Jan 6, 2024
168e6b3
wip
timothycarambat Jan 6, 2024
2088472
wip
timothycarambat Jan 6, 2024
025cc26
wip
timothycarambat Jan 6, 2024
ade0fef
add helper method
timothycarambat Jan 6, 2024
0d7a759
remove testing build branch
timothycarambat Jan 6, 2024
b2f9ef3
docker readme updates
timothycarambat Jan 6, 2024
456b225
correct colspan
timothycarambat Jan 6, 2024
5d4b52f
update command layout
timothycarambat Jan 6, 2024
23335d4
update build file for latest tag
timothycarambat Jan 6, 2024
24cebd7
try single build step
timothycarambat Jan 6, 2024
5a34eb5
checkpoint for dual build image
timothycarambat Jan 6, 2024
7ea4641
update job runner
timothycarambat Jan 6, 2024
df221ab
test concurrency
timothycarambat Jan 6, 2024
c86937e
remove clean.sh script
timothycarambat Jan 6, 2024
2101801
remove test branch
timothycarambat Jan 6, 2024
922f244
wip: latest tag
timothycarambat Jan 8, 2024
8a17243
wip: latest tag
timothycarambat Jan 8, 2024
00003ce
add dev branch
timothycarambat Jan 8, 2024
358d82b
verified conditional latest tagging on master only
timothycarambat Jan 8, 2024
ad3da99
ready for merge
timothycarambat Jan 8, 2024
104278a
remove platform option from docker-compose.yml
shatfield4 Jan 8, 2024
dbba1f7
Merge with master
timothycarambat Jan 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions .github/workflows/build-and-push-image.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
name: Publish Docker image and Github Registry
# This Github action is for publishing of the primary image for AnythingLLM
# It will publish a linux/amd64 and linux/arm64 image at the same time
# This file should ONLY BY USED FOR `master` BRANCH.
# TODO: Update `runs-on` for arm64 when GitHub finally supports
# native arm environments as QEMU takes around 1 hour to build
# ref: https://github.com/actions/runner-images/issues/5631 :(
name: Publish AnythingLLM Primary Docker image (amd64/arm64)

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches: ['master']
branches: ['master'] # master branch only. Do not modify.
paths-ignore:
- '*.md'
- 'cloud-deployments/*'
Expand All @@ -11,15 +21,26 @@ on:
- '**/.env.example'

jobs:
push_to_registries:
name: Push Docker image to multiple registries
push_multi_platform_to_registries:
name: Push Docker multi-platform image to multiple registries
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Parse repository name to lowercase
shell: bash
run: echo "repo=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
id: lowercase_repo

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
Expand All @@ -42,11 +63,15 @@ jobs:
mintplexlabs/anythingllm
ghcr.io/${{ github.repository }}

- name: Build and push Docker images
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
- name: Build and push multi-platform Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
tags: |
${{ steps.meta.outputs.tags }}
${{ github.ref_name == 'master' && 'mintplexlabs/anythingllm:latest' || '' }}
${{ github.ref_name == 'master' && format('ghcr.io/{0}:{1}', steps.lowercase_repo.outputs.repo, 'latest') || '' }}
labels: ${{ steps.meta.outputs.labels }}
3 changes: 0 additions & 3 deletions clean.sh

This file was deleted.

2 changes: 1 addition & 1 deletion collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"multer": "^1.4.5-lts.1",
"officeparser": "^4.0.5",
"pdf-parse": "^1.1.1",
"puppeteer": "^21.6.1",
"puppeteer": "~21.5.2",
"slugify": "^1.6.6",
"url-pattern": "^1.0.3",
"uuid": "^9.0.0",
Expand Down
50 changes: 25 additions & 25 deletions collector/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@
resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570"
integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==

"@puppeteer/browsers@1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-1.9.0.tgz#dfd0aad0bdc039572f1b57648f189525d627b7ff"
integrity sha512-QwguOLy44YBGC8vuPP2nmpX4MUN2FzWbsnvZJtiCzecU3lHmVZkaC1tq6rToi9a200m8RzlVtDyxCS0UIDrxUg==
"@puppeteer/browsers@1.8.0":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@puppeteer/browsers/-/browsers-1.8.0.tgz#fb6ee61de15e7f0e67737aea9f9bab1512dbd7d8"
integrity sha512-TkRHIV6k2D8OlUe8RtG+5jgOF/H98Myx0M6AOafC8DdNVOFiBSFa5cpRDtpm8LXOa9sVwe0+e6Q3FC56X/DZfg==
dependencies:
debug "4.3.4"
extract-zip "2.0.1"
Expand Down Expand Up @@ -608,10 +608,10 @@ chownr@^2.0.0:
resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==

chromium-bidi@0.5.1:
version "0.5.1"
resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-0.5.1.tgz#390c1af350c4887824a33d82190de1cc5c5680fc"
integrity sha512-dcCqOgq9fHKExc2R4JZs/oKbOghWpUNFAJODS8WKRtLhp3avtIH5UDCBrutdqZdh3pARogH8y1ObXm87emwb3g==
chromium-bidi@0.4.33:
version "0.4.33"
resolved "https://registry.yarnpkg.com/chromium-bidi/-/chromium-bidi-0.4.33.tgz#9a9aba5a5b07118c8e7d6405f8ee79f47418dd1d"
integrity sha512-IxoFM5WGQOIAd95qrSXzJUv4eXIrh+RvU3rwwqIiwYuvfE7U/Llj4fejbsJnjJMUYCuGtVQsY2gv7oGl4aTNSQ==
dependencies:
mitt "3.0.1"
urlpattern-polyfill "9.0.0"
Expand Down Expand Up @@ -2584,26 +2584,26 @@ pump@^3.0.0:
end-of-stream "^1.1.0"
once "^1.3.1"

puppeteer-core@21.6.1:
version "21.6.1"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-21.6.1.tgz#10eccb4dc3167c8c26bc21122fabb45a9fda9ca7"
integrity sha512-0chaaK/RL9S1U3bsyR4fUeUfoj51vNnjWvXgG6DcsyMjwYNpLcAThv187i1rZCo7QhJP0wZN8plQkjNyrq2h+A==
puppeteer-core@21.5.2:
version "21.5.2"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-21.5.2.tgz#6d3de4efb2ae65f1ee072043787b75594e88035f"
integrity sha512-v4T0cWnujSKs+iEfmb8ccd7u4/x8oblEyKqplqKnJ582Kw8PewYAWvkH4qUWhitN3O2q9RF7dzkvjyK5HbzjLA==
dependencies:
"@puppeteer/browsers" "1.9.0"
chromium-bidi "0.5.1"
"@puppeteer/browsers" "1.8.0"
chromium-bidi "0.4.33"
cross-fetch "4.0.0"
debug "4.3.4"
devtools-protocol "0.0.1203626"
ws "8.15.1"
ws "8.14.2"

puppeteer@^21.6.1:
version "21.6.1"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-21.6.1.tgz#2ec0878906ff90b3a424f19e5eb006592abe25b6"
integrity sha512-O+pbc61oj8ln6m8EJKncrsQFmytgRyFYERtk190PeLbJn5JKpmmynn2p1PiFrlhCitAQXLJ0MOy7F0TeyCRqBg==
puppeteer@~21.5.2:
version "21.5.2"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-21.5.2.tgz#0a4a72175c0fd0944d6486f4734807e1671d527b"
integrity sha512-BaAGJOq8Fl6/cck6obmwaNLksuY0Bg/lIahCLhJPGXBFUD2mCffypa4A592MaWnDcye7eaHmSK9yot0pxctY8A==
dependencies:
"@puppeteer/browsers" "1.9.0"
"@puppeteer/browsers" "1.8.0"
cosmiconfig "8.3.6"
puppeteer-core "21.6.1"
puppeteer-core "21.5.2"

qs@6.11.0:
version "6.11.0"
Expand Down Expand Up @@ -3259,10 +3259,10 @@ wrappy@1:
resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==

ws@8.15.1:
version "8.15.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.15.1.tgz#271ba33a45ca0cc477940f7f200cd7fba7ee1997"
integrity sha512-W5OZiCjXEmk0yZ66ZN82beM5Sz7l7coYxpRkzS+p9PP+ToQry8szKh+61eNktr7EA9DOwvFGhfC605jDHbP6QQ==
ws@8.14.2:
version "8.14.2"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.14.2.tgz#6c249a806eb2db7a20d26d51e7709eab7b2e6c7f"
integrity sha512-wEBG1ftX4jcglPxgFCMJmZ2PLtSbJ2Peg6TmpJFTbe9GZYOQCDPdMYu/Tm0/bGZkw8paZnJY45J4K2PZrLYq8g==

xmlbuilder@^10.0.0:
version "10.1.1"
Expand Down
80 changes: 69 additions & 11 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Setup base image
FROM ubuntu:jammy-20230522 AS base

# Build arguments
ARG ARG_UID=1000
ARG ARG_GID=1000

# Install system dependencies
FROM base AS build-arm64
RUN echo "Preparing build of AnythingLLM image for arm64 architecture"

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
curl gnupg libgfortran5 libgbm1 tzdata netcat \
unzip curl gnupg libgfortran5 libgbm1 tzdata netcat \
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 \
libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
Expand Down Expand Up @@ -38,21 +39,78 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chmod +x /usr/local/bin/docker-healthcheck.sh

USER anythingllm
WORKDIR /app

# Puppeteer does not ship with an ARM86 compatible build for Chromium
# so web-scraping would be broken in arm docker containers unless we patch it
# by manually installing a compatible chromedriver.
RUN echo "Need to patch Puppeteer x Chromium support for ARM86 - installing dep!" && \
curl https://playwright.azureedge.net/builds/chromium/1088/chromium-linux-arm64.zip -o chrome-linux.zip && \
unzip chrome-linux.zip && \
rm -rf chrome-linux.zip

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV CHROME_PATH=/app/chrome-linux/chrome
ENV PUPPETEER_EXECUTABLE_PATH=/app/chrome-linux/chrome

RUN echo "Done running arm64 specific installtion steps"

#############################################

# amd64-specific stage
FROM base AS build-amd64
RUN echo "Preparing build of AnythingLLM image for non-ARM architecture"

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends \
curl gnupg libgfortran5 libgbm1 tzdata netcat \
libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 \
libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libx11-6 libx11-xcb1 libxcb1 \
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release \
xdg-utils git build-essential ffmpeg && \
mkdir -p /etc/apt/keyrings && \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && \
apt-get update && \
apt-get install -yq --no-install-recommends nodejs && \
curl -LO https://github.com/yarnpkg/yarn/releases/download/v1.22.19/yarn_1.22.19_all.deb \
&& dpkg -i yarn_1.22.19_all.deb \
&& rm yarn_1.22.19_all.deb

# Create a group and user with specific UID and GID
RUN groupadd -g $ARG_GID anythingllm && \
useradd -u $ARG_UID -m -d /app -s /bin/bash -g anythingllm anythingllm && \
mkdir -p /app/frontend/ /app/server/ /app/collector/ && chown -R anythingllm:anythingllm /app

# Copy docker helper scripts
COPY ./docker/docker-entrypoint.sh /usr/local/bin/
COPY ./docker/docker-healthcheck.sh /usr/local/bin/
COPY --chown=anythingllm:anythingllm ./docker/.env.example /app/server/.env

# Ensure the scripts are executable
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \
chmod +x /usr/local/bin/docker-healthcheck.sh

#############################################
# COMMON BUILD FLOW FOR ALL ARCHS
#############################################
FROM build-${TARGETARCH} AS build
RUN echo "Running common build flow of AnythingLLM image for all architectures"

USER anythingllm
WORKDIR /app

# Install frontend dependencies
FROM base as frontend-deps
FROM build as frontend-deps

COPY ./frontend/package.json ./frontend/yarn.lock ./frontend/
RUN cd ./frontend/ && yarn install && yarn cache clean
RUN cd ./frontend/ && yarn install --network-timeout 100000 && yarn cache clean

# Install server dependencies
FROM base as server-deps
FROM build as server-deps
COPY ./server/package.json ./server/yarn.lock ./server/
RUN cd ./server/ && yarn install --production && yarn cache clean && \
rm /app/server/node_modules/vectordb/x86_64-apple-darwin.node && \
rm /app/server/node_modules/vectordb/aarch64-apple-darwin.node
RUN cd ./server/ && yarn install --production --network-timeout 100000 && yarn cache clean

# Compile Llama.cpp bindings for node-llama-cpp for this operating system.
USER root
Expand All @@ -75,7 +133,7 @@ COPY --from=build-stage /app/frontend/dist ./server/public
COPY --chown=anythingllm:anythingllm ./collector/ ./collector/

# Install collector dependencies
RUN cd /app/collector && yarn install --production && yarn cache clean
RUN cd /app/collector && yarn install --production --network-timeout 100000 && yarn cache clean

# Migrate and Run Prisma against known schema
RUN cd ./server && npx prisma generate --schema=./prisma/schema.prisma
Expand All @@ -93,4 +151,4 @@ HEALTHCHECK --interval=1m --timeout=10s --start-period=1m \
CMD /bin/bash /usr/local/bin/docker-healthcheck.sh || exit 1

# Run the server
ENTRYPOINT ["/bin/bash", "/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["/bin/bash", "/usr/local/bin/docker-entrypoint.sh"]
21 changes: 16 additions & 5 deletions docker/HOW_TO_USE_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ Use the Dockerized version of AnythingLLM for a much faster and complete startup
> It is best to mount the containers storage volume to a folder on your host machine
> so that you can pull in future updates without deleting your existing data!

`docker pull mintplexlabs/anythingllm:master`
Pull in the latest image from docker. Supports both `amd64` and `arm64` CPU architectures.
```shell
docker pull mintplexlabs/anythingllm
```

<table>
<tr>
<th>Linux/MacOs</th>
<th>Windows Powershell</th>
<th colspan="2">Mount the storage locally and run AnythingLLM in Docker</th>
</tr>
<tr>
<td>
Linux/MacOs
</td>
<td>

```shell
Expand All @@ -48,13 +53,19 @@ docker run -d -p 3001:3001 \
-v ${STORAGE_LOCATION}:/app/server/storage \
-v ${STORAGE_LOCATION}/.env:/app/server/.env \
-e STORAGE_DIR="/app/server/storage" \
mintplexlabs/anythingllm:master
mintplexlabs/anythingllm
```

</td>
</tr>
<tr>
<td>
Windows
</td>
<td>

```powershell
# Run this in powershell terminal
$env:STORAGE_LOCATION="$HOME\Documents\anythingllm"; `
If(!(Test-Path $env:STORAGE_LOCATION)) {New-Item $env:STORAGE_LOCATION -ItemType Directory}; `
If(!(Test-Path "$env:STORAGE_LOCATION\.env")) {New-Item "$env:STORAGE_LOCATION\.env"}; `
Expand All @@ -63,7 +74,7 @@ docker run -d -p 3001:3001 `
-v "$env:STORAGE_LOCATION`:/app/server/storage" `
-v "$env:STORAGE_LOCATION\.env:/app/server/.env" `
-e STORAGE_DIR="/app/server/storage" `
mintplexlabs/anythingllm:master;
mintplexlabs/anythingllm;
```

</td>
Expand Down
3 changes: 1 addition & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '3.9'
version: "3.9"

name: anythingllm

Expand All @@ -10,7 +10,6 @@ services:
anything-llm:
container_name: anything-llm
image: anything-llm:latest
platform: linux/amd64
build:
context: ../.
dockerfile: ./docker/Dockerfile
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"swagger-ui-express": "^5.0.0",
"uuid": "^9.0.0",
"uuid-apikey": "^1.5.3",
"vectordb": "0.1.12",
"vectordb": "0.1.19",
"weaviate-ts-client": "^1.4.0"
},
"devDependencies": {
Expand Down
Loading