Skip to content

Commit 24046f9

Browse files
authored
Merge pull request #16 from mvanhorn/feat/docker-devcontainer
feat(docker): add Dockerfile and devcontainer.json quickstart
2 parents 6469b07 + ca7c329 commit 24046f9

5 files changed

Lines changed: 136 additions & 0 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "smfs",
3+
"build": {
4+
"context": "..",
5+
"dockerfile": "../Dockerfile"
6+
},
7+
"runArgs": [
8+
"--device",
9+
"/dev/fuse",
10+
"--cap-add",
11+
"SYS_ADMIN"
12+
],
13+
"overrideCommand": true,
14+
"remoteEnv": {
15+
"SUPERMEMORY_API_KEY": "${localEnv:SUPERMEMORY_API_KEY}",
16+
"SUPERMEMORY_API_URL": "${localEnv:SUPERMEMORY_API_URL}"
17+
},
18+
"customizations": {
19+
"vscode": {
20+
"extensions": [
21+
"rust-lang.rust-analyzer"
22+
]
23+
}
24+
}
25+
}

.dockerignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
.git/
2+
.devcontainer/
3+
target/
4+
5+
bash/node_modules/
6+
bash/.turbo/
7+
bash/dist/
8+
bash/coverage/
9+
10+
bash-py/.venv/
11+
bash-py/__pycache__/
12+
bash-py/.pytest_cache/
13+
bash-py/dist/
14+
bash-py/build/

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM rust:1.80-slim AS builder
2+
3+
WORKDIR /src
4+
ENV RUSTUP_TOOLCHAIN=1.80.0
5+
6+
RUN apt-get update && apt-get install -y --no-install-recommends \
7+
pkg-config \
8+
libssl-dev \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
COPY . .
12+
13+
RUN cargo build --release --bin smfs
14+
15+
FROM debian:bookworm-slim
16+
17+
RUN apt-get update && apt-get install -y --no-install-recommends \
18+
ca-certificates \
19+
fuse3 \
20+
&& rm -rf /var/lib/apt/lists/*
21+
22+
COPY --from=builder /src/target/release/smfs /usr/local/bin/smfs
23+
24+
ENTRYPOINT ["smfs"]
25+
CMD ["--help"]

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Two access flows depending on the runtime:
2020
- [Semantic search](#semantic-search)
2121
- [`bash/` virtual bash tool](#bash-virtual-bash-tool)
2222
- [Build from source](#build-from-source)
23+
- [Docker and devcontainers](#docker-and-devcontainers)
2324
- [License](#license)
2425

2526
## Install
@@ -152,6 +153,63 @@ cargo build --release
152153

153154
Requires Rust 1.80 or newer.
154155

156+
## Docker and devcontainers
157+
158+
### Run smfs in Docker
159+
160+
Build the development image from this checkout:
161+
162+
```sh
163+
docker build -t smfs:dev .
164+
docker run --rm smfs:dev --help
165+
```
166+
167+
Mount a Supermemory container inside Docker with FUSE enabled:
168+
169+
```sh
170+
docker run --rm -it \
171+
--device /dev/fuse \
172+
--cap-add SYS_ADMIN \
173+
-e SUPERMEMORY_API_KEY="$SUPERMEMORY_API_KEY" \
174+
smfs:dev mount agent_memory --path /mnt/memory
175+
```
176+
177+
The release Dockerfile uses the same installer as the shell quickstart:
178+
179+
```sh
180+
docker build -t smfs:release -f docker/Dockerfile.release .
181+
```
182+
183+
When an official image is published, the same run flags apply:
184+
185+
```sh
186+
docker run --rm -it \
187+
--device /dev/fuse \
188+
--cap-add SYS_ADMIN \
189+
-e SUPERMEMORY_API_KEY="$SUPERMEMORY_API_KEY" \
190+
ghcr.io/supermemoryai/smfs:latest mount agent_memory --path /mnt/memory
191+
```
192+
193+
### Use smfs inside a devcontainer
194+
195+
Open this repository in VS Code or Cursor and choose "Reopen in Container".
196+
The devcontainer builds the root `Dockerfile`, passes through `SUPERMEMORY_API_KEY`
197+
and `SUPERMEMORY_API_URL`, and starts with `smfs` on `PATH`.
198+
199+
### FUSE requirements
200+
201+
Docker runs Linux containers, so smfs uses the FUSE backend in Docker. The NFS
202+
backend is for macOS hosts and is not used inside Linux containers.
203+
204+
FUSE needs access to `/dev/fuse` and the `SYS_ADMIN` capability:
205+
206+
```sh
207+
--device /dev/fuse --cap-add SYS_ADMIN
208+
```
209+
210+
If your Docker environment does not expose `/dev/fuse`, use a Linux host or a
211+
container runtime that supports FUSE devices.
212+
155213
## License
156214

157215
MIT. See [`LICENSE`](LICENSE).

docker/Dockerfile.release

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM debian:bookworm-slim
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
ca-certificates \
5+
curl \
6+
fuse3 \
7+
&& rm -rf /var/lib/apt/lists/*
8+
9+
ARG SMFS_VERSION=latest
10+
11+
RUN curl -fsSL https://smfs.ai/install | SMFS_INSTALL_DIR=/usr/local/bin bash -s -- "${SMFS_VERSION}"
12+
13+
ENTRYPOINT ["smfs"]
14+
CMD ["--help"]

0 commit comments

Comments
 (0)