|
| 1 | +# Embeddings OCI Examples |
| 2 | + |
| 3 | +This directory contains examples for pulling and pushing vector database embeddings to/from OCI registries. |
| 4 | + |
| 5 | +## Pull Example |
| 6 | + |
| 7 | +Downloads the embeddings OCI artifact and installs the vector.db directory to `~/.docker/mcp/`. |
| 8 | + |
| 9 | +### Usage |
| 10 | + |
| 11 | +```bash |
| 12 | +# From repository root |
| 13 | +go run ./examples/embeddings/pull.go |
| 14 | +``` |
| 15 | + |
| 16 | +The Pull function will: |
| 17 | +1. Download the image from `jimclark106/embeddings:latest` |
| 18 | +2. Extract all layers to a temporary directory |
| 19 | +3. Verify that `vectors.db` file exists |
| 20 | +4. Copy `vectors.db` to `~/.docker/mcp/` (skips if already exists) |
| 21 | +5. Clean up temporary files |
| 22 | + |
| 23 | +## Push Example |
| 24 | + |
| 25 | +Creates an OCI artifact from a local vector.db directory and pushes it to a registry. |
| 26 | + |
| 27 | +### Usage |
| 28 | + |
| 29 | +```bash |
| 30 | +# From repository root |
| 31 | +go run ./examples/embeddings/push.go <vector-db-path> <oci-ref> |
| 32 | +``` |
| 33 | + |
| 34 | +### Example |
| 35 | + |
| 36 | +```bash |
| 37 | +# Push the local vectors.db to your own registry |
| 38 | +go run ./examples/embeddings/push.go ~/.docker/mcp/vectors.db jimclark106/embeddings:v1.0 |
| 39 | +``` |
| 40 | + |
| 41 | +The Push function will: |
| 42 | +1. Verify the source directory exists |
| 43 | +2. Create a tar archive from the entire directory tree (always naming the root as `vectors.db` in the archive) |
| 44 | +3. Create an OCI image layer from the tar |
| 45 | +4. Push the image to the specified OCI reference |
| 46 | + |
| 47 | +Note: Regardless of your local directory name, the OCI artifact will always contain `vectors.db` at the root for consistency. |
| 48 | + |
| 49 | +## Authentication |
| 50 | + |
| 51 | +Both examples use the Docker credential helper for authentication. Make sure you're logged in to the registry: |
| 52 | + |
| 53 | +```bash |
| 54 | +docker login |
| 55 | +``` |
| 56 | + |
| 57 | +## Notes |
| 58 | + |
| 59 | +- Pull is idempotent - it won't overwrite existing `vectors.db` files |
| 60 | +- Push requires write access to the specified OCI registry |
| 61 | +- Push always stores the directory as `vectors.db` in the OCI artifact for consistency |
| 62 | +- File permissions and symlinks are preserved during push/pull operations |
0 commit comments