Examples
Build with all dependencies:Flags
--no-deps
Skip transitive dependencies during pip install. Only installs direct dependencies specified in
@Endpoint decorators. Useful when the base image already includes dependencies.Custom name for the output archive file.
Comma-separated list of packages to exclude from the build (e.g.,
torch,torchvision). Use this to skip packages already in the base image.Target Python version for worker images (3.10, 3.11, or 3.12). Overrides per-resource
python_version declarations. Defaults to the version declared on resource configs, or 3.12 if none set.What happens during build
- Python version resolution: Resolves the target Python version from CLI flag, resource configs, or default (3.12).
- Function discovery: Finds all
@Endpointdecorated functions. - Grouping: Groups functions by their endpoint configuration.
- Manifest generation: Creates
.flash/flash_manifest.jsonwith endpoint definitions. - Dependency installation: Installs Python packages for Linux x86_64.
- Packaging: Bundles everything into
.flash/artifact.tar.gz.
Built-in ignore patterns
Flash automatically excludes certain files and directories from deployment artifacts. These patterns cover common development files that shouldn’t be deployed to production.| Category | Patterns |
|---|---|
| Build artifacts | .build/, .flash/, .runpod/, *.tar.gz, .git/, __pycache__/, *.pyc, *.pyo, *.pyd, *.egg-info/, dist/, build/ |
| Virtual environments | .venv/, venv/, env/ |
| IDE files | .vscode/, .idea/ |
| Environment files | .env, .env.local |
| Tests | tests/, test_*.py, *_test.py |
| Documentation | docs/, *.md (except README.md) |
.gitignore file and excludes any files matching those patterns.
Build artifacts
After runningflash build:
| File/Directory | Description |
|---|---|
.flash/artifact.tar.gz | Deployment package ready for Runpod |
.flash/flash_manifest.json | Service discovery configuration |
.flash/.build/ | Build directory (kept for inspection) |
Cross-platform builds
Flash automatically handles cross-platform builds:- Automatic platform targeting: Dependencies are installed for Linux x86_64, regardless of your build platform.
- Binary wheel enforcement: Only pre-built wheels are used, preventing compilation issues.
Python version in deployed workers
Flash workers support Python 3.10, 3.11, and 3.12. The target version is determined by:- CLI flag: The
--python-versionflag takes precedence. - Resource config: The
python_versionparameter on your endpoint configs. - Default: Python 3.12 when neither is specified.
| Version | Cold start | Notes |
|---|---|---|
| 3.12 (default) | No overhead | PyTorch pre-installed in base image |
| 3.11 | +~7 GB on GPU | Alternative Python install required |
| 3.10 | +~7 GB on GPU | EOL 2026-10-31; consider migrating to 3.11 |
py{version}-{tag} (for example, runpod/flash:py3.12-latest).
Managing deployment size
Runpod Serverless has a 1.5GB deployment limit. Flash automatically excludes packages that are pre-installed in the base image:torch,torchvision,torchaudio,triton
Manual exclusions
Use--exclude to skip additional packages that are already in a custom base image or not needed:
Base image reference
| Resource type | Base image | Auto-excluded packages |
|---|---|---|
| GPU | PyTorch base | torch, torchvision, torchaudio, triton |
| CPU | Python slim | torch, torchvision, torchaudio, triton |
Troubleshooting
Build fails with “functions not found”
Ensure your project has@Endpoint decorated functions:
Archive is too large
Some CUDA packages (torch, torchvision, torchaudio, triton) are auto-excluded. If the archive is still too large, use --exclude to skip additional packages or --no-deps to skip transitive dependencies:
Dependency installation fails
If a package doesn’t have Linux x86_64 wheels:- Ensure standard pip is installed:
python -m ensurepip --upgrade - Check PyPI for Linux wheel availability.
Need to examine generated files
The build directory is kept after building. Inspect it with:Related commands
flash deploy- Build and deploy in one step (includes--previewoption for local testing)flash run- Start development serverflash env- Manage environments
Most users should use
flash deploy instead, which runs build and deploy in one step. Use flash build when you need more control or want to inspect the artifact.