image option when you create it. There are several kinds to choose from:
If you plan to run commands in the sandbox (rather than use it to serve an app), add
"ready": "process".
Without it, Fibre runs the image’s own startup command and waits for it to answer on its port. See
sizes and installed tools for the details.Build an image from a Dockerfile
A Dockerfile is a recipe for an image: start from this base, install these packages, copy in this code. Fibre can build an image from a Dockerfile for you. You do not need Docker on your machine, or a registry to store the result. You send the Dockerfile and the files it uses, Fibre builds the image, and the image is then ready to use in your account’s sandboxes. This example builds a small web API written with FastAPI, a popular Python framework, and then runs it in a sandbox that serves it at a public address.1
Write the app and its Dockerfile
2
Send it to Fibre
Send the folder containing the Dockerfile as a single archive. (This folder is called the build context: the
Dockerfile can only use files that are inside it.)
The build runs on Fibre while you wait or do something else. This one takes about 15 seconds. If you send exactly
the same files and Dockerfile as an earlier build, Fibre does not build again. It answers straight away with
Response
Response
response
"status": "succeeded", the earlier image, and "cached": true.3
Follow the build
Output
Output
output
end line with the final
status. It works just like a command’s output.4
Run it
When the build has succeeded, its
image field holds the name of the new image. Pass that name to a sandbox. This
image runs a web server on port 8000, so the sandbox is reported as ready once the app answers, and the
sandbox’s address then serves the API:Response
Response
response
curl: start it and call it
Output
Output
output
Build options
You can adjust a build with these query parameters onPOST /v1/builds:
While it runs and after it ends, a build has one of these statuses:
A build runs in a sandbox of its own and is billed like one while it runs. The build context can be up to 2 GB.
Image or snapshot?
Both images and snapshots give new sandboxes a head start, so it is worth knowing which to use. The difference is memory: an image keeps only files, while a snapshot also keeps running programs and everything in memory.Errors
Clean up
Related
Snapshots
Save a sandbox’s whole state and start new sandboxes from it, programs already running.
Private registries
Run images from your own registry.