Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
38 changes: 38 additions & 0 deletions .github/workflows/docker-release.yml
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
69 changes: 69 additions & 0 deletions Dockerfile
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 && \

Copilot AI Dec 6, 2025

Copy link

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.txt

This will make the image much smaller and build faster, which likely addresses the storage issue mentioned in the PR description.

Suggested change
. .venv/bin/activate && \
. .venv/bin/activate && \
pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \

Copilot uses AI. Check for mistakes.
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"]
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Docker instructions don't explain that nexum is an interactive CLI application. Users following these instructions will find the container starts but they can't interact with it.

Add a note explaining how to connect to the interactive shell. For example:

### Run the application

```bash
$ docker compose up -d
$ docker exec -it nexumdb nexum

Or run it interactively:

$ docker compose run --rm nexumdb-app

This will help users understand how to actually use the Dockerized application.
```suggestion

> **Note:** NexumDB is an interactive CLI application. After starting the container, you need to connect to the CLI to interact with the database.
>
> To open an interactive shell in the running container:
>
> ```bash
> $ docker exec -it nexumdb nexum
> ```
>
> Or run it interactively (without starting in detached mode):
>
> ```bash
> $ docker compose run --rm nexumdb-app
> ```

Copilot uses AI. Check for mistakes.

Copilot AI Dec 6, 2025

Copy link

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.

Suggested change

Copilot uses AI. Check for mistakes.
### Stop the application

Copilot AI Dec 6, 2025

Copy link

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.

Suggested change
### Stop the application
### Stop the application

Copilot uses AI. Check for mistakes.

```bash
$ docker compose down
```

### Logs

```bash
$ docker compose logs
```
Comment on lines +62 to +93

Copilot AI Dec 6, 2025

Copy link

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:

  1. That users need to create a config.toml file before running
  2. What should be in the config.toml file
  3. That a ./data directory will be created for persistent storage
  4. What ports the application uses (if any)

Consider adding a prerequisites or configuration section before the Docker commands explaining these requirements.

Copilot uses AI. Check for mistakes.

## Python Dependencies

```bash
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3.8"

Copilot AI Dec 6, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version field in docker-compose.yaml is obsolete. Docker Compose v1.27.0+ (and all v2.x versions) no longer require or use the top-level version field. The Compose Specification considers it optional and the field is ignored.

Consider removing this line:

services:
  nexumdb-app:
    build:
Suggested change
version: "3.8"

Copilot uses AI. Check for mistakes.
services:
nexumdb-app:
build:
context: .
dockerfile: Dockerfile
container_name: nexumdb
environment:
- PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
- RUST_LOG=info
volumes:
- ./data:/app/data