diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml index d0f48700..9c0d7ba3 100644 --- a/.github/workflows/images.yaml +++ b/.github/workflows/images.yaml @@ -1,7 +1,5 @@ name: Docker Dev Images Build - - on: workflow_dispatch: push: @@ -16,6 +14,16 @@ jobs: permissions: contents: read packages: write + strategy: + matrix: + include: + - target: main + file: Dockerfile + image_name: librechat-rag-api-dev + - target: lite + file: Dockerfile.lite + image_name: librechat-rag-api-dev-lite + steps: # Check out the repository - name: Checkout @@ -37,14 +45,15 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Build and push Docker image - - name: Build and push Docker image + # Build and push Docker images for each target + - name: Build and push Docker images uses: docker/build-push-action@v5 with: context: . - file: Dockerfile + file: ${{ matrix.file }} push: true tags: | - ghcr.io/${{ github.repository_owner }}/librechat-rag-api-dev:${{ github.sha }} - ghcr.io/${{ github.repository_owner }}/librechat-rag-api-dev:latest + ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:${{ github.sha }} + ghcr.io/${{ github.repository_owner }}/${{ matrix.image_name }}:latest platforms: linux/amd64,linux/arm64 + target: ${{ matrix.target }} diff --git a/Dockerfile.lite b/Dockerfile.lite new file mode 100644 index 00000000..06d7d04d --- /dev/null +++ b/Dockerfile.lite @@ -0,0 +1,16 @@ +FROM python:3.10 AS base + +WORKDIR /app + +# Install pandoc and netcat +RUN apt-get update \ + && apt-get install -y pandoc netcat-openbsd \ + && rm -rf /var/lib/apt/lists/* + +COPY requirements.lite.txt . +RUN pip install --no-cache-dir -r requirements.lite.txt + +COPY . . + +FROM base AS lite +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] diff --git a/main.py b/main.py index 8a3bba09..86adfa02 100644 --- a/main.py +++ b/main.py @@ -6,7 +6,6 @@ from shutil import copyfileobj from langchain.schema import Document from contextlib import asynccontextmanager -from fastapi.responses import JSONResponse from dotenv import find_dotenv, load_dotenv from fastapi.middleware.cors import CORSMiddleware from langchain_core.runnables.config import run_in_executor diff --git a/requirements.lite.txt b/requirements.lite.txt new file mode 100644 index 00000000..81bbf4ed --- /dev/null +++ b/requirements.lite.txt @@ -0,0 +1,22 @@ +langchain==0.1.12 +langchain_community==0.0.28 +langchain_openai==0.0.8 +langchain_core==0.1.32 +sqlalchemy==2.0.28 +python-dotenv==1.0.1 +fastapi==0.110.0 +psycopg2-binary==2.9.9 +pgvector==0.2.5 +uvicorn==0.28.0 +pypdf==4.1.0 +unstructured==0.12.6 +markdown==3.6 +networkx==3.2.1 +pandas==2.2.1 +openpyxl==3.1.2 +docx2txt==0.8 +pypandoc==1.13 +python-jose==3.3.0 +asyncpg==0.29.0 +python-multipart==0.0.9 +aiofiles==23.2.1