Overview
File Mounts allow you to inject file content directly into your Devbox at creation time. This is ideal for small configuration files, scripts, or any text content that you want to include without uploading to storage first.For larger files or binary data, consider using Object Mounts instead. For runtime file operations, see Read and Write Files.
Use Cases
File mounts are particularly useful for:- Configuration files: Inject JSON, YAML, or TOML configuration
- Environment files: Add
.envfiles with environment-specific settings - Scripts: Include setup scripts or utility scripts
- SSH keys: Add authorized keys or known hosts
- Small data files: Include test fixtures or sample data
Creating a File Mount
Use themounts parameter with type: "file_mount" to inject file content:
File Mount Parameters
| Parameter | Required | Description |
|---|---|---|
type | Yes | Must be "file_mount" |
target | Yes | Absolute path where the file should be created |
content | Yes | The text content of the file |
Examples
Mounting a Python Script
Mounting Multiple Configuration Files
Limitations
- Text content only: File mounts support UTF-8 text content. For binary files, use Object Mounts.
- Size limits: Individual file mounts have a maximum size limit. For large files, use Object Mounts.
- Absolute paths: The
targetpath must be an absolute path (e.g.,/home/user/file.txt).
Best Practices
- Use for small files: File mounts are best for configuration files and small scripts. For larger files, use Object Mounts.
- Avoid sensitive data: Don’t include secrets directly in file content. Use Account Secrets instead.
- Use absolute paths: Always specify the full path starting with
/. - Create parent directories: Parent directories are created automatically if they don’t exist.
