Skip to navigation

Upload local files for a Dockerfile build

Uploads the directory that a Dockerfile’s COPY and ADD lines read from. The body is a gzipped tar of that directory, sent with Content-Type: application/gzip. Pass the returned id as build_context_id on POST /v1/images. Meadow hands the same files to every vendor that builds the image.

Limits:

  • 100 MB compressed (104,857,600 bytes). A larger body returns 413.
  • 512 MiB and 10,000 entries after unpacking.
  • Regular files and directories only. Links and device files return 400.
  • Paths must be relative and stay inside the archive root.
  • The upload must finish within 10 minutes.

Larger inputs, such as datasets and model weights, belong in a base image or should be downloaded during the build.

Uploading the same bytes again returns the same id and moves expires_at forward. A context expires 24 hours after its last use. There is no call to delete one, and a project cannot be deleted until its build contexts have expired.

A failure to store a valid archive returns 500. The upload can be retried.

Scope: sandboxes.

The archive can come from a file or straight from a pipe. Some tar builds, the one on macOS among them, pad what they write to a pipe with zero bytes after the gzip stream. Meadow accepts that padding. Any other data after the gzip stream, a wrong checksum, or a stream that is cut short returns 400.

tar -czf ctx.tgz -C ./ctx .
curl -sS -X POST "$MEADOW_BASE_URL/v1/build-contexts" \
-H "Authorization: Bearer $MEADOW_API_KEY" \
-H "Content-Type: application/gzip" \
--data-binary @ctx.tgz

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Request

A gzipped tar archive, at most 100 MB.

Response headers

x-request-idstringOptional

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.

Response

Stored. Also returned when the same bytes were uploaded before.
idstring

Pass as build_context_id on POST /v1/images.

sha256string
Hash of the uploaded bytes.
size_bytesinteger
Size of the uploaded archive in bytes.
expires_atdatetime
When the context is removed, 24 hours after its last use.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
413
Content Too Large Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error