|
| 1 | +--- |
| 2 | +title: pkg |
| 3 | +sidebar: |
| 4 | + order: 106 |
| 5 | +--- |
| 6 | + |
| 7 | +:::caution |
| 8 | +This command is currently limited to python **agent workflows**. |
| 9 | +Frontend packaging is **not yet supported**. |
| 10 | +::: |
| 11 | + |
| 12 | +The `pkg` command group lets you package and export your application for custom deployments. |
| 13 | +Currently it supports exporting a Dockerfile that can be built into an image with any OCI compliant image builder, such as `docker` or `podman`. |
| 14 | + |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +```bash |
| 19 | +llamactl pkg [COMMAND] [options] |
| 20 | +``` |
| 21 | + |
| 22 | +### Available Commands |
| 23 | + |
| 24 | +- `container` – Generate a minimal, build-ready container file (e.g., `Dockerfile`) for your workflows. |
| 25 | + |
| 26 | + |
| 27 | +## Command: `container` |
| 28 | + |
| 29 | +```bash |
| 30 | +llamactl pkg container [DEPLOYMENT_FILE] [options] |
| 31 | +``` |
| 32 | + |
| 33 | +Generates a container build file from a given deployment file and user-specified options. |
| 34 | + |
| 35 | +### Options |
| 36 | + |
| 37 | + |
| 38 | +- `deployment_file` - Path to the deployment file. Defaults to the current directory (`.`) |
| 39 | +- `--python-version` - Python version for the base image. If not specified, it's inferred from `.python-version` or `pyproject.toml`; defaults to **3.12** if none found. |
| 40 | +- `--port <int>` - Port to expose for the API server. Defaults to 4501. |
| 41 | +- `--dockerignore-path` - Path for the generated `.dockerignore` file. Defaults to `.dockerignore`. |
| 42 | +- `--overwrite` - Overwrite any existing output files. No default value. |
| 43 | +- `--exclude <path>` - Path(s) to exclude from the build (appended to `.dockerignore`). Can be used multiple times. No default value. |
| 44 | +- `--output-file` - Path and filename for the generated container build file. Defaults to `Dockerfile`. |
| 45 | +- `--help` - Show help for this command and exit. No default value. |
| 46 | + |
| 47 | +### Notes |
| 48 | + |
| 49 | +- The generated `.dockerignore` file automatically excludes common Python-related directories such as: |
| 50 | + - Local virtual environments |
| 51 | + - Caches |
| 52 | + - Files that may contain sensitive data (e.g., `.env`) |
| 53 | +- The produced container file is **minimal by design**. It should work for most cases, but you may need to customize it for specific use cases. |
| 54 | + |
| 55 | +### Examples |
| 56 | + |
| 57 | +**1. Create default `Dockerfile` and `.dockerignore`:** |
| 58 | +```bash |
| 59 | +llamactl pkg container |
| 60 | +``` |
| 61 | + |
| 62 | +**2. Generate a custom container file with specific name, Python version, and port:** |
| 63 | +```bash |
| 64 | +llamactl pkg container --output-file Containerfile --python-version 3.14 --port 4502 |
| 65 | +``` |
| 66 | + |
| 67 | +**3. Exclude certain files or directories from the build:** |
| 68 | +```bash |
| 69 | +llamactl pkg container --exclude .env.local --exclude .github/workflows/ --exclude "*.pdf" |
| 70 | +``` |
0 commit comments