Build an image from a Dockerfile
Builds an image on each sandbox vendor from Dockerfile text, so that sandboxes
can start from it with image_id. The call returns at once. Each vendor’s build
has its own status in builds. Poll GET /v1/images/{image_id}, or pass
?wait=true to hold the request until every build is ready or failed.
The same Dockerfile text and build context always give the same image id
within a project. Calling this again for an image that exists returns it with
200 and builds nothing, so a caller that starts the same environment many times
builds once. name is a label and is not part of the identity.
If the Dockerfile copies local files (COPY, ADD), upload them first with
POST /v1/build-contexts and pass the returned id as build_context_id.
Rules:
dockerfileis required and at most 512 KiB.build_onpicks the vendors to build on now. Left out, Meadow builds on every vendor in the project’s sandbox order that the account has a key for. A vendor that is not built here builds on first use by a sandbox, which counts toward that sandbox’s create timeout.- On a project with
routing.lock, sendingbuild_onreturns 403. rebuild: truebuilds again and keeps the sameid. The previous build’s vendor image is removed, unless a sandbox created from this image is stillcreating,running, orterminating.- Daytona does not support
registry_auth. A build that sends it fails on Daytona. - A sandbox from
image_idgets the size it asks for on both vendors. Daytona fixes resources on a snapshot, so Meadow keeps one Daytona snapshot per image and size, and the first sandbox of a new size waits for that snapshot to be made. Seeimage_idonPOST /v1/sandboxes. - Unknown fields return 400.
Scope: sandboxes.
Authentication
A Meadow API key, sent as Authorization: Bearer mdw_.... The header
x-api-key: mdw_... is accepted in its place.
Headers
Makes a retry safe. A repeat with the same key and the same body returns the
result of the first call instead of starting again. The same key with a
different body returns 409. On POST /v1/keys, POST /v1/projects and
POST /v1/images a value is scoped to the API key that sent it: another key
that sends the same value starts its own request. The sandbox and exec
routes scope it to the API key too. On the exec route the header only has an
effect with background: true. See Idempotency in the introduction for how
long a value is kept.
The key is 1 to 255 bytes of printable ASCII. A blank, longer, or non-ASCII key, or the header sent twice, returns 400. A UUID works well.
Query parameters
When true, hold the request until every build started by this call is ready or failed, or until wait_timeout_seconds passes.
Longest time to hold the request when wait is true, in seconds, from 1 to
1800. A value outside that range returns 400. The builds continue after the
wait ends.
Request
Local files for the build, from POST /v1/build-contexts. Without it, COPY of local files fails.
Build again even when an image with these inputs exists. The id stays the same.
The previous build’s vendor image is removed, unless a sandbox created with this
image_id is still live.
Response headers
Meadow’s id for this request, req_ and 24 hex characters. Every response
carries it, including errors, streams and unknown routes. Every error in the
Error schema repeats it as request_id. Quote it when you report a problem.
true when this response is the saved result of an earlier request with the
same Idempotency-Key. Absent on a first response. Sent by POST /v1/keys,
POST /v1/projects, POST /v1/images, POST /v1/sandboxes and a background
POST /v1/sandboxes/{sandbox_id}/exec. On the two sandbox routes the body is the
sandbox or the command as it is now.
Response
Pass as image_id on POST /v1/sandboxes.
active: the image can be used.deleting:DELETE /v1/images/{image_id}was called and a vendor image is still being removed. Adeletingimage cannot start a sandbox. Posting the same Dockerfile again builds a new image with a newid.deleted: shown only on an image withvendor_copies_may_remain, which stays readable. Any other deleted image returns 404.
Vendors where Meadow stopped trying to delete its copy of this image, so a
copy may still exist there. Absent when there are none. See
DELETE /v1/images/{image_id}. An active image can carry it too: a rebuild
removes the previous build’s vendor image under the same rule. Deleting such
an image later returns 200, not 204, and it stays readable as deleted.