From ca7c329f3341cb1e20bc9aa2aaee304f97265c23 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Sun, 10 May 2026 15:36:27 -0700 Subject: [PATCH] feat(docker): add Dockerfile and devcontainer.json quickstart The README says smfs works in Docker, devcontainers, Codespaces, and microVMs but ships no working example. e2b ships a Dockerfile and devcontainer.json. This closes the parity gap. - Dockerfile (root): two-stage build from rust:1.80-slim builder to debian:bookworm-slim runtime. Image runs smfs --help out of the box. - docker/Dockerfile.release: pulls binaries via the smfs.ai install script. For users who want a stable image, not a from-source build. - .devcontainer/devcontainer.json: VS Code / Cursor devcontainer config. Builds the root Dockerfile, passes through SUPERMEMORY_API_KEY, mounts /dev/fuse with SYS_ADMIN for FUSE. - .dockerignore: keeps target/, .git/, node_modules out of build context. - README.md: new Docker and devcontainers section with the FUSE caveat called out (--device /dev/fuse --cap-add SYS_ADMIN required). --- .devcontainer/devcontainer.json | 25 ++++++++++++++ .dockerignore | 14 ++++++++ Dockerfile | 25 ++++++++++++++ README.md | 58 +++++++++++++++++++++++++++++++++ docker/Dockerfile.release | 14 ++++++++ 5 files changed, 136 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker/Dockerfile.release diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0f065f4 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +{ + "name": "smfs", + "build": { + "context": "..", + "dockerfile": "../Dockerfile" + }, + "runArgs": [ + "--device", + "/dev/fuse", + "--cap-add", + "SYS_ADMIN" + ], + "overrideCommand": true, + "remoteEnv": { + "SUPERMEMORY_API_KEY": "${localEnv:SUPERMEMORY_API_KEY}", + "SUPERMEMORY_API_URL": "${localEnv:SUPERMEMORY_API_URL}" + }, + "customizations": { + "vscode": { + "extensions": [ + "rust-lang.rust-analyzer" + ] + } + } +} diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..953c608 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.git/ +.devcontainer/ +target/ + +bash/node_modules/ +bash/.turbo/ +bash/dist/ +bash/coverage/ + +bash-py/.venv/ +bash-py/__pycache__/ +bash-py/.pytest_cache/ +bash-py/dist/ +bash-py/build/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e687683 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM rust:1.80-slim AS builder + +WORKDIR /src +ENV RUSTUP_TOOLCHAIN=1.80.0 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + pkg-config \ + libssl-dev \ + && rm -rf /var/lib/apt/lists/* + +COPY . . + +RUN cargo build --release --bin smfs + +FROM debian:bookworm-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + fuse3 \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=builder /src/target/release/smfs /usr/local/bin/smfs + +ENTRYPOINT ["smfs"] +CMD ["--help"] diff --git a/README.md b/README.md index a1adf0d..8000bd5 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Two access flows depending on the runtime: - [Semantic search](#semantic-search) - [`bash/` virtual bash tool](#bash-virtual-bash-tool) - [Build from source](#build-from-source) +- [Docker and devcontainers](#docker-and-devcontainers) - [License](#license) ## Install @@ -152,6 +153,63 @@ cargo build --release Requires Rust 1.80 or newer. +## Docker and devcontainers + +### Run smfs in Docker + +Build the development image from this checkout: + +```sh +docker build -t smfs:dev . +docker run --rm smfs:dev --help +``` + +Mount a Supermemory container inside Docker with FUSE enabled: + +```sh +docker run --rm -it \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + -e SUPERMEMORY_API_KEY="$SUPERMEMORY_API_KEY" \ + smfs:dev mount agent_memory --path /mnt/memory +``` + +The release Dockerfile uses the same installer as the shell quickstart: + +```sh +docker build -t smfs:release -f docker/Dockerfile.release . +``` + +When an official image is published, the same run flags apply: + +```sh +docker run --rm -it \ + --device /dev/fuse \ + --cap-add SYS_ADMIN \ + -e SUPERMEMORY_API_KEY="$SUPERMEMORY_API_KEY" \ + ghcr.io/supermemoryai/smfs:latest mount agent_memory --path /mnt/memory +``` + +### Use smfs inside a devcontainer + +Open this repository in VS Code or Cursor and choose "Reopen in Container". +The devcontainer builds the root `Dockerfile`, passes through `SUPERMEMORY_API_KEY` +and `SUPERMEMORY_API_URL`, and starts with `smfs` on `PATH`. + +### FUSE requirements + +Docker runs Linux containers, so smfs uses the FUSE backend in Docker. The NFS +backend is for macOS hosts and is not used inside Linux containers. + +FUSE needs access to `/dev/fuse` and the `SYS_ADMIN` capability: + +```sh +--device /dev/fuse --cap-add SYS_ADMIN +``` + +If your Docker environment does not expose `/dev/fuse`, use a Linux host or a +container runtime that supports FUSE devices. + ## License MIT. See [`LICENSE`](LICENSE). diff --git a/docker/Dockerfile.release b/docker/Dockerfile.release new file mode 100644 index 0000000..c8bac45 --- /dev/null +++ b/docker/Dockerfile.release @@ -0,0 +1,14 @@ +FROM debian:bookworm-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates \ + curl \ + fuse3 \ + && rm -rf /var/lib/apt/lists/* + +ARG SMFS_VERSION=latest + +RUN curl -fsSL https://smfs.ai/install | SMFS_INSTALL_DIR=/usr/local/bin bash -s -- "${SMFS_VERSION}" + +ENTRYPOINT ["smfs"] +CMD ["--help"]