Skip to content

Commit e01909e

Browse files
committed
docs(deploy): buildpacks — cerebrium support, python fallback, --buildpack override
1 parent 0a70809 commit e01909e

1 file changed

Lines changed: 39 additions & 14 deletions

File tree

content/deploy/build-requirements.mdx

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,24 @@ When you run `faable deploy`, the CLI inspects your repository, detects the stac
1010

1111
## 🔍 How Detection Works
1212

13-
The builder checks for these files at the project root, **in order** — the first match decides the runtime:
13+
Deploys are built by **buildpacks** (Heroku/CNB-style): each one checks for its trigger files at the project root, **in order** — the first match decides how your app is built:
1414

15-
| Priority | File found | Runtime |
16-
| :------- | :------------------------------------------------- | :------------------------------------------ |
17-
| 1 | `package.json` | **Node.js** (see below) |
18-
| 2 | `requirements.txt`, `pyproject.toml`, or `Pipfile` | **Python** (see below) |
19-
| 3 | `Dockerfile` | **Docker** — your Dockerfile, built verbatim |
20-
|| None of the above | ❌ Deploy fails: `Cannot detect project type` |
15+
| Priority | File found | Buildpack |
16+
| :------- | :--------------------------------------------------------------------- | :-------------------------------------------- |
17+
| 1 | `package.json` | **Node.js** (see below) |
18+
| 2 | `requirements.txt`, `pyproject.toml`, `Pipfile`, or `cerebrium.toml` | **Python** (see below) |
19+
| 3 | `Dockerfile` | **Docker** — your Dockerfile, built verbatim |
20+
| 4 | `main.py`, `app.py`, or `wsgi.py` (fallback, no manifest at all) | **Python** without dependency install (see below) |
21+
|| None of the above | ❌ Deploy fails with a diagnostic listing what was looked for, what your repo contains, and any config from another platform it recognizes |
2122

2223
> [!IMPORTANT]
23-
> The order matters: if your repo has both a `package.json` and a `Dockerfile`, it is built as a **Node.js** project and the Dockerfile is ignored. The Dockerfile path is the escape hatch for stacks the builder doesn't detect natively.
24+
> The order matters: if your repo has both a `package.json` and a `Dockerfile`, it is built as a **Node.js** project and the Dockerfile is ignored. The Dockerfile path is the escape hatch for stacks the buildpacks don't detect natively.
25+
26+
You can skip detection entirely and **force a buildpack**`node`, `python`, or `docker` — with the `buildpack` field in `faable.json` or the `--buildpack` (`-b`) CLI flag:
27+
28+
```bash
29+
faable deploy --buildpack docker
30+
```
2431

2532
---
2633

@@ -78,20 +85,22 @@ Next.js is the exception: it always runs as a server (`next start`), with a pers
7885

7986
## 🐍 Python Projects
8087

81-
Detected by `requirements.txt`, `pyproject.toml`, or `Pipfile`. Unlike Node, **dependencies install inside the image build** (`pip install -r requirements.txt`, `pip install .`, or `pipenv install` respectively).
88+
Detected by `requirements.txt`, `pyproject.toml`, `Pipfile`, or `cerebrium.toml`. Unlike Node, **dependencies install inside the image build** (`pip install -r requirements.txt`, `pip install .`, `pipenv install`, or the pip table of `cerebrium.toml` respectively). With a `requirements.txt`, the manifest is copied into its own image layer before the install, so rebuilding after a source-only change reuses the cached dependency layer.
8289

8390
**Python version**, first match wins:
8491

8592
1. `runtime.txt` — e.g. `python-3.12.1`
8693
2. `.python-version`
87-
3. `requires-python` in `pyproject.toml`
88-
4. Default: `3.11.3`
94+
3. The manifest's own version (e.g. `python_version` in `cerebrium.toml`)
95+
4. `requires-python` in `pyproject.toml`
96+
5. Default: `3.11.3`
8997

9098
**Start command**, first match wins:
9199

92100
1. `startCommand` in `faable.json`
93101
2. A `web:` line in a `Procfile`
94-
3. Framework auto-detection:
102+
3. A start command declared by the manifest (e.g. the Cerebrium `entrypoint`)
103+
4. Framework auto-detection:
95104
- **Django** (`manage.py` + a package with `wsgi.py`) → `gunicorn <pkg>.wsgi:application --bind 0.0.0.0:$PORT`
96105
- **FastAPI / Starlette**`uvicorn <module>:app --host 0.0.0.0 --port $PORT`
97106
- **Flask**`gunicorn <module>:app --bind 0.0.0.0:$PORT`
@@ -100,11 +109,21 @@ For FastAPI and Flask the builder finds your app module by checking, in order: `
100109

101110
If no framework is recognized and there's no `Procfile` or `startCommand`, the deploy fails and asks you to provide one.
102111

112+
### Cerebrium Projects
113+
114+
A repo shaped for [Cerebrium](https://www.cerebrium.ai) — a `cerebrium.toml` plus a Python entrypoint, no `requirements.txt` — deploys out of the box. Faable reads the `[cerebrium.dependencies.pip]` table (and `[cerebrium.dependencies.paths] pip` when present) to install dependencies, `python_version` from `[cerebrium.deployment]`, and the `[cerebrium.runtime.custom] entrypoint` as the start command when set. `apt` and `conda` tables are not installed. If your repo also has a classic manifest, the classic manifest wins.
115+
116+
Because Faable runs **web services**, your project still needs a web entrypoint (a FastAPI/Flask app, a `Procfile`, or `startCommand` in `faable.json`) — a bare GPU function without one fails with an explanation.
117+
118+
### Python Without a Manifest
119+
120+
A lone `main.py` / `app.py` / `wsgi.py` with no dependency manifest at all is picked up by the Python fallback: the app builds **without installing any dependencies** (the deploy logs warn loudly). Framework detection still works by reading the entrypoint file itself, and `uvicorn`/`gunicorn` are added when the start command needs them. If your app imports anything beyond the standard library, add a `requirements.txt`. Note this fallback loses against a `Dockerfile` — an explicit Dockerfile always wins over a loose `.py` file.
121+
103122
---
104123

105124
## 🐳 Dockerfile Projects
106125

107-
No `package.json`, no Python manifests, but a `Dockerfile`? The builder runs `docker build .` on it **verbatim** — you control everything. Just honor the port contract below.
126+
No `package.json`, no Python manifests, but a `Dockerfile`? The buildpack runs `docker build` on it **verbatim** (targeting `linux/amd64`, so images built on Apple Silicon run on the platform) — you control everything. Just honor the port contract below. If a `package.json` with a `next` dependency sits beside the Dockerfile (reachable by forcing `--buildpack docker`), the deploy is registered as a Next.js app so the platform provisions its build cache.
108127

109128
---
110129

@@ -128,6 +147,7 @@ The platform also injects `FAABLE_HOST` (your app's public URL). `PORT` and `FAA
128147
{
129148
"app_id": "app_xxx",
130149
"app_slug": "my-app",
150+
"buildpack": "docker",
131151
"buildCommand": "npm run build:prod",
132152
"startCommand": "node dist/main.js"
133153
}
@@ -136,6 +156,7 @@ The platform also injects `FAABLE_HOST` (your app's public URL). `PORT` and `FAA
136156
| Field | Purpose |
137157
| :------------- | :---------------------------------------------------------------------------------------------- |
138158
| `app_id` / `app_slug` | Which Faable app this repo deploys to (written by `faable link`). |
159+
| `buildpack` | Force a buildpack (`node`, `python`, `docker`) instead of auto-detection. The `--buildpack` CLI flag beats it. |
139160
| `buildCommand` | Build step to run when `package.json` has no `build` script (Node), or custom install command (Python). |
140161
| `startCommand` | Overrides everything — framework detection and `npm run start`. |
141162

@@ -149,7 +170,11 @@ The Node image copies your working directory as-is and never runs `npm install`.
149170

150171
### I have a Dockerfile but Faable ignores it — why?
151172

152-
Because there's also a `package.json` (or Python manifest) at the root, which takes precedence. Remove it from the root, or embrace the zero-config Node/Python pipeline.
173+
Because there's also a `package.json` (or Python manifest) at the root, which takes precedence. Force it with `--buildpack docker` (or `"buildpack": "docker"` in `faable.json`), remove the manifest from the root, or embrace the zero-config Node/Python buildpacks.
174+
175+
### My repo was made for another platform (Cerebrium, Replicate, Fly…) — will it deploy?
176+
177+
Cerebrium projects deploy natively (see above). For other platforms, the detection error names the config file it recognized (`cog.yaml`, `fly.toml`, `render.yaml`…) — Faable can't consume those directly; add one of the supported manifests or a `Dockerfile`.
153178

154179
### Which Node version does my app run on?
155180

0 commit comments

Comments
 (0)