Building with Docker
We provide a Docker image to build Encoderfiles without installing any dependencies on your system.
Use it for when you don't want to manage a local toolchain, or when you prefer running builds in an isolated environment for things like CI or ephemeral workers.
You can pull the image from our image registry:
docker pull ghcr.io/mozilla-ai/encoderfile:latestMounting Assets
The Docker container needs access to the following elements to build an Encoderfile:
Config file - Your
encoderfile.ymlpassed via-fflagModel assets - ONNX file, tokenizer,
config.jsonreferenced byencoderfile.yml.Output directory - Where the
.encoderfilebinary will be written
All paths in your config must exist inside the container. Mount your project directory to /opt/encoderfile (the default working directory) so encoderfile can find everything and write the output back to your host machine.
Minimal Example
Assuming your directory looks like this:
project/
model/
model.onnx
tokenizer.json
config.json
encoderfile.ymlAnd your build config (encoderfile.yml) looks like this:
Run the following:
What happens:
Your current directory is mounted into the container at
/opt/encoderfile.Inside the container, Encoderfile sees
encoderfile.ymland any model paths exactly as they appear in your project.The resulting
.encoderfilebinary is written back into your project directory
Troubleshooting
“File not found: model.onnx”
Your path in config.yml doesn’t match where the file appears inside the container. Most of the time this is a missing -v "$(pwd):/opt/encoderfile" or a mismatched working directory.
“cargo not found”
You’re not using the correct image. Make sure you are using ghcr.io/mozilla-ai/encoderfile:latest
Paths behave differently on Windows
Use absolute paths or WSL. Docker-for-Windows path translation varies by shell.
Last updated