-
-
Notifications
You must be signed in to change notification settings - Fork 42
feat: add docker compose setup for Containerize #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
saurabhraghuvanshii
wants to merge
25
commits into
jenkinsci:main
Choose a base branch
from
saurabhraghuvanshii:docker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+612
−39
Open
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
54e0ab6
feat: add intial docker compose setup
saurabhraghuvanshii d5344f0
Merge branch 'main' into docker
saurabhraghuvanshii 632f070
feat: add for GPU docker
saurabhraghuvanshii 0db7b23
fix: forntend build
saurabhraghuvanshii 8980fe1
fix: api in ngix
saurabhraghuvanshii f45e7e3
Merge branch 'main' into docker
saurabhraghuvanshii 32f372a
Merge branch 'main' into docker
saurabhraghuvanshii a9ef3a1
chore: update readme with new instructions
saurabhraghuvanshii e434872
update address
saurabhraghuvanshii ebb18ed
Merge branch 'main' into docker
saurabhraghuvanshii 23d05a9
chore: update Dockergpu for cuda faling address
saurabhraghuvanshii 65db612
Merge branch 'main' into docker
cnu1812 ad9e97c
chore: python 3.12
saurabhraghuvanshii 4b48937
fix: typescript typerror
saurabhraghuvanshii a5949bd
fix: module error
saurabhraghuvanshii a78e262
fix: eslint and module for frontend and backend pytest install
saurabhraghuvanshii a7aaa00
fix pytest
saurabhraghuvanshii e23ab27
Add extra pytest install
saurabhraghuvanshii aaf60d1
Changed from CommonJS to nodenext
saurabhraghuvanshii cddb7a4
add pytest install in requirements.txt
saurabhraghuvanshii e266b7f
revert requirment.txt
saurabhraghuvanshii 7b386b1
add support for import at build time
saurabhraghuvanshii 7f2bddf
Merge branch 'main' into docker
saurabhraghuvanshii f165537
fix: import issue of env
saurabhraghuvanshii b870f8f
Merge branch 'main' into docker
berviantoleo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,3 +44,5 @@ src/main/webapp/static/* | |
| .settings | ||
| .classpath | ||
| .project | ||
|
|
||
| .env | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,10 +11,11 @@ This plugin was developed as part of a Google Summer of Code 2025 project. | |
| ## Prerequisites | ||
|
|
||
| - **Python**: 3.11+ | ||
| - **Build tools**: `make`, `cmake` (≥3.14), C/C++ compiler (`gcc`/`clang`/MSVC) | ||
| - **Java**: JDK 11+ and Maven 3.6+ (for plugin development) | ||
| - **Node.js**: 20+ (for frontend) | ||
| - **Build tools**: `make`, `cmake` (≥3.14), C/C++ compiler | ||
| - **Java**: JDK 11+ and Maven 3.6+ (for Jenkins plugin) | ||
|
|
||
| ### Example system package installation | ||
| **Install system dependencies:** | ||
|
|
||
| ```bash | ||
| # Ubuntu/Debian/WSL | ||
|
|
@@ -24,57 +25,143 @@ sudo apt install -y make cmake gcc g++ python3.11 python3.11-venv python3.11-dev | |
| brew install cmake [email protected] && xcode-select --install | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### 1. Setup Backend | ||
|
|
||
| ## Getting Started | ||
| From project root: | ||
|
|
||
| ### Setup | ||
| ```bash | ||
| # For CPU-only (recommended for most systems) | ||
| make setup-backend IS_CPU_REQ=1 | ||
|
|
||
| # For GPU support | ||
| make setup-backend | ||
| ``` | ||
|
|
||
| Complete the full setup process in [docs/setup.md](docs/setup.md) before running any commands. This includes creating a virtual environment, installing Python dependencies (including llama-cpp-python), and configuring the data pipeline. | ||
| ### 2. Download LLM Model | ||
|
|
||
| ### Running the API | ||
| Download the Mistral model and place it in the correct location: | ||
|
|
||
| ```bash | ||
| mkdir -p chatbot-core/api/models/mistral | ||
| # Download mistral-7b-instruct-v0.2.Q4_K_M.gguf from: | ||
| # https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF | ||
| # Place it in: chatbot-core/api/models/mistral/ | ||
| ``` | ||
|
|
||
| ### 3. Run API | ||
|
|
||
| Once setup is complete, from the **project root directory** run: | ||
| ```bash | ||
| make api | ||
| ``` | ||
|
|
||
| The API will be available at `http://127.0.0.1:8000`. | ||
| API will be available at `http://127.0.0.1:8000` | ||
|
|
||
| **Verify it's working:** | ||
|
|
||
| Verify it's working: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:8000/api/chatbot/sessions | ||
| ``` | ||
|
|
||
| ### 4. Build Frontend | ||
|
|
||
| ```bash | ||
| make build-frontend | ||
| ``` | ||
|
|
||
| See [docs/README.md](docs/README.md) for detailed explanations. | ||
| ### 5. Run with Docker (Alternative) | ||
|
|
||
| ## Troubleshooting | ||
| **Prerequisites:** | ||
|
|
||
| - Docker and Docker Compose installed | ||
|
|
||
| **llama-cpp-python installation fails**: Ensure build tools are installed and use Python 3.11+ | ||
| **Steps:** | ||
|
|
||
| **API crashes on startup**: | ||
| This may be caused by missing optional dependencies (e.g. `retriv`). | ||
| 1. **Download LLM Model** (if not already done): | ||
|
|
||
| ```bash | ||
| mkdir -p chatbot-core/api/models/mistral | ||
| # Download mistral-7b-instruct-v0.2.Q4_K_M.gguf from: | ||
| # https://huggingface.co/TheBloke/Mistral-7B-Instruct-v0.2-GGUF | ||
| # Place it in: chatbot-core/api/models/mistral/ | ||
| ``` | ||
|
|
||
| 2. **Build and run containers:** | ||
|
|
||
| ```bash | ||
| docker-compose up --build | ||
| ``` | ||
|
|
||
| 3. **Access services:** | ||
| - Backend API: `http://127.0.0.1:8000` | ||
| - Frontend UI: `http://127.0.0.1:80` | ||
| - API Docs: `http://127.0.0.1:8000/docs` | ||
|
|
||
| **Stop containers:** | ||
|
|
||
| Try installing missing packages: | ||
| ```bash | ||
| pip install llama-cpp-python retriv | ||
| docker-compose down | ||
| ``` | ||
|
|
||
| **General issues**: Run `make clean && make <target>`, verify your virtual environment is activated, and ensure all dependencies from [docs/setup.md](docs/setup.md) are installed. | ||
| **For GPU support:** | ||
|
|
||
| ## Developer Documentation | ||
| ```bash | ||
| docker-compose -f docker-compose.gpu.yml up --build | ||
| ``` | ||
|
|
||
| ## Data Pipeline | ||
|
|
||
| Development-related documentation can be found in the [`docs/`](docs/) directory. | ||
| To populate the knowledge base with Jenkins documentation: | ||
|
|
||
| ## Contributing | ||
| ```bash | ||
| make run-data-pipeline | ||
| ``` | ||
|
|
||
| Refer to our [contribution guidelines](https://github.com/jenkinsci/.github/blob/master/CONTRIBUTING.md) | ||
| This collects, preprocesses, chunks, and stores data in the vector database. | ||
|
|
||
| ## Testing | ||
|
|
||
| ```bash | ||
| # Run all tests | ||
| make run-test | ||
|
|
||
| # Frontend tests only | ||
| make run-frontend-tests | ||
|
|
||
| # Backend tests only | ||
| make run-backend-tests | ||
| ``` | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| **llama-cpp-python installation fails:** | ||
|
|
||
| ```bash | ||
| sudo apt install build-essential cmake # Linux | ||
| brew install cmake # macOS | ||
| pip install llama-cpp-python | ||
| ``` | ||
|
|
||
| **API crashes on startup:** | ||
|
|
||
| ```bash | ||
| cd chatbot-core && source venv/bin/activate | ||
| pip install llama-cpp-python retriv | ||
| ``` | ||
|
|
||
| **Clean and rebuild:** | ||
|
|
||
| ```bash | ||
| make clean && make setup-backend IS_CPU_REQ=1 | ||
| ``` | ||
|
|
||
| ## LICENSE | ||
| ## Documentation | ||
|
|
||
| Licensed under MIT, see [LICENSE](LICENSE.md) | ||
| - Setup details: [docs/setup.md](docs/setup.md) | ||
| - Architecture: [docs/README.md](docs/README.md) | ||
| - API docs: [docs/chatbot-core/api/](docs/chatbot-core/api/) | ||
|
|
||
| ## License | ||
|
|
||
| MIT License - see [LICENSE.md](LICENSE.md) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
| .Python | ||
| venv/ | ||
| env/ | ||
| ENV/ | ||
| .venv | ||
|
|
||
| # IDE | ||
| .vscode/ | ||
| .idea/ | ||
| *.swp | ||
| *.swo | ||
| *~ | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .coverage | ||
| htmlcov/ | ||
| .tox/ | ||
|
|
||
| # Logs | ||
| *.log | ||
| logs/ | ||
|
|
||
| # Data directories (will be mounted as volumes) | ||
| data/raw/ | ||
| data/processed/ | ||
| data/embeddings/ | ||
| data/chunking/ | ||
|
|
||
| # Model files (will be mounted as volumes) | ||
| api/models/mistral/ | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Documentation | ||
| docs/ | ||
| *.md | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| FROM python:3.14-slim AS builder | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| build-essential \ | ||
| cmake \ | ||
| git \ | ||
| gfortran \ | ||
| pkg-config \ | ||
| libxml2-dev \ | ||
| libxslt1-dev \ | ||
| libopenblas-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY requirements-cpu.txt /app/requirements.cpu.txt | ||
saurabhraghuvanshii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| RUN pip install --no-cache-dir --upgrade pip && \ | ||
| pip install --no-cache-dir -r requirements.cpu.txt | ||
|
|
||
| FROM python:3.14-slim | ||
saurabhraghuvanshii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| libstdc++6 \ | ||
| libxml2 \ | ||
| libxslt1.1 \ | ||
| libopenblas0 \ | ||
| curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN useradd -m -u 1000 appuser && \ | ||
| mkdir -p /app/data /app/models && \ | ||
| chown -R appuser:appuser /app | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages | ||
| COPY --from=builder /usr/local/bin/uvicorn /usr/local/bin/ | ||
|
|
||
| COPY --chown=appuser:appuser . /app | ||
|
|
||
| ENV PYTHONPATH=/app | ||
| ENV PYTHONUNBUFFERED=1 | ||
|
|
||
| USER appuser | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ | ||
| CMD curl -f http://localhost:8000/docs || exit 1 | ||
|
|
||
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| FROM nvidia/cuda:12.6.0-runtime-ubuntu22.04 AS base | ||
saurabhraghuvanshii marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| software-properties-common \ | ||
| && add-apt-repository ppa:deadsnakes/ppa \ | ||
| && apt-get update && apt-get install -y \ | ||
| python3.14 \ | ||
| python3.14-dev \ | ||
| python3.14-distutils \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN curl -sS https://bootstrap.pypa.io/get-pip.py | python3.14 | ||
|
|
||
| RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.14 1 && \ | ||
| update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.14 1 | ||
|
|
||
| FROM base AS builder | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| build-essential \ | ||
| cmake \ | ||
| git \ | ||
| gfortran \ | ||
| pkg-config \ | ||
| libxml2-dev \ | ||
| libxslt1-dev \ | ||
| libopenblas-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY requirements.txt /app/requirements.gpu.txt | ||
|
|
||
| RUN pip install --no-cache-dir --upgrade pip && \ | ||
| pip install --no-cache-dir -r requirements.gpu.txt | ||
saurabhraghuvanshii marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| FROM base | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| libstdc++6 \ | ||
| libxml2 \ | ||
| libxslt1.1 \ | ||
| libopenblas0 \ | ||
| curl \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN useradd -m -u 1000 appuser && \ | ||
| mkdir -p /app/data /app/models && \ | ||
| chown -R appuser:appuser /app | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=builder /usr/local/lib/python3.14/site-packages /usr/local/lib/python3.14/site-packages | ||
| COPY --from=builder /usr/local/bin/uvicorn /usr/local/bin/ | ||
|
|
||
| COPY --chown=appuser:appuser . /app | ||
|
|
||
| ENV PYTHONPATH=/app | ||
| ENV PYTHONUNBUFFERED=1 | ||
|
|
||
| USER appuser | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ | ||
| CMD curl -f http://localhost:8000/docs || exit 1 | ||
|
|
||
| CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "8000"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.