-
-
Notifications
You must be signed in to change notification settings - Fork 26
Feature/add dockerfile and docker compose and add new release workflow #30
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
Changes from all commits
149d801
c4a7b20
c09f564
1f5f9c9
dd83131
d1b9f1a
939b078
a5f65bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Build and Release Docker Image | ||
|
|
||
| on: | ||
| release: | ||
| types: [created] | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Docker Hub account login | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Extract release tag | ||
| id: meta | ||
| run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: Dockerfile | ||
| push: true | ||
| tags: | | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/nexumdb:latest | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/nexumdb:${{ steps.meta.outputs.version }} | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/nexumdb:${{ github.sha }} | ||
| cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/nexumdb:buildcache | ||
| cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/nexumdb:buildcache,mode=max |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| ################################################## | ||
| #################### STAGE 1 ##################### | ||
| ################################################## | ||
| FROM rust:1-bookworm AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| python3 \ | ||
| python3-dev \ | ||
| build-essential \ | ||
| libssl-dev \ | ||
| pkg-config \ | ||
| ca-certificates \ | ||
| libclang-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| COPY Cargo.toml Cargo.lock ./ | ||
| COPY nexum_cli/Cargo.toml ./nexum_cli/ | ||
| COPY nexum_core/Cargo.toml ./nexum_core/ | ||
| COPY tests/Cargo.toml ./tests/ | ||
|
|
||
| RUN mkdir -p nexum_core/src && echo "" > nexum_core/src/lib.rs | ||
| RUN mkdir -p nexum_cli/src && echo "fn main() {}" > nexum_cli/src/main.rs | ||
| RUN mkdir -p tests/src && echo "" > tests/src/lib.rs | ||
|
|
||
| ENV PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 | ||
| RUN cargo build --release --workspace | ||
|
|
||
| COPY nexum_core ./nexum_core | ||
| COPY nexum_cli ./nexum_cli | ||
| COPY tests ./tests | ||
|
|
||
| RUN cargo test --release --workspace | ||
| RUN touch nexum_cli/src/main.rs && cargo build --release --workspace --exclude tests | ||
|
|
||
|
|
||
| ################################################## | ||
| #################### STAGE 2 ##################### | ||
| ################################################## | ||
| FROM debian:bookworm-slim | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| python3 \ | ||
| python3-venv \ | ||
| python3-dev \ | ||
| libssl-dev \ | ||
| ca-certificates \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=builder /app/target/release/nexum /usr/local/bin/nexum | ||
| COPY nexum_ai ./nexum_ai | ||
|
|
||
| RUN useradd --system --create-home --home-dir /app --shell /bin/bash nexumuser && \ | ||
| chown -R nexumuser:nexumuser /app | ||
|
|
||
| USER nexumuser | ||
|
|
||
| RUN python3 -m venv .venv && \ | ||
| . .venv/bin/activate && \ | ||
| pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ | ||
| pip install --no-cache-dir -r nexum_ai/requirements.txt | ||
|
|
||
| ENV PATH="/app/.venv/bin:$PATH" | ||
| ENV VIRTUAL_ENV="/app/.venv" | ||
|
|
||
| CMD ["nexum"] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -59,6 +59,39 @@ export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 | |||||
| cargo build --release | ||||||
| ``` | ||||||
|
|
||||||
| ## Build, run and stop the application using docker compose | ||||||
|
|
||||||
| ### Build the application | ||||||
|
|
||||||
| ```bash | ||||||
| $ docker compose build | ||||||
| ``` | ||||||
|
|
||||||
| ### Run the application | ||||||
|
|
||||||
| ```bash | ||||||
| $ docker compose up | ||||||
| ``` | ||||||
|
|
||||||
| ### Run an interactive shell | ||||||
|
|
||||||
| ```bash | ||||||
| $ docker compose up -d | ||||||
| $ docker exec -it nexumdb nexum | ||||||
| ``` | ||||||
|
|
||||||
|
||||||
Copilot
AI
Dec 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line has trailing whitespace. Remove it for cleaner formatting.
| ### Stop the application | |
| ### Stop the application |
Copilot
AI
Dec 6, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing documentation for required setup: The docker-compose.yaml references environment variables, volumes (./data and ./config.toml), but the README doesn't document:
- That users need to create a
config.tomlfile before running - What should be in the
config.tomlfile - That a
./datadirectory will be created for persistent storage - What ports the application uses (if any)
Consider adding a prerequisites or configuration section before the Docker commands explaining these requirements.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,12 @@ | ||||
| version: "3.8" | ||||
|
||||
| version: "3.8" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing PyTorch and ML dependencies without specifying CPU-only versions will default to downloading CUDA-enabled packages, which are significantly larger (~2-3GB extra). For a general Docker image, consider using CPU-only PyTorch to reduce image size:
RUN python3 -m venv .venv && \ . .venv/bin/activate && \ pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \ pip install --no-cache-dir -r nexum_ai/requirements.txtThis will make the image much smaller and build faster, which likely addresses the storage issue mentioned in the PR description.