Deployments
A deployment is a container for assets, environment variables, compiler options, and other data related to a deployed serverless application.
Create a deployment
Compiler options
The compilerOptions
key of the POST
body sent with a deployment creation
request can override the options usually configured
here in deno.json.
Compiler options will determine how your application's TypeScript code will be
processed.
If null
is provided, Deploy will attempt to discover a deno.json
or
deno.jsonc
within the assets of your deployment (see Deployment assets
below). If an empty object {}
is provided, Deploy will use default TypeScript
configuration.
Deployment assets
The assets associated with a deployment are the code and static files that drive
the behavior of the deployment and handle incoming requests. In JSON body sent
with a POST
request to this endpoint, you will include an assets
attribute
that contains keys that represent the file path to a particular asset.
So for example - a file that would live in a deployment directory under
server/main.ts
would use that path as the key for the asset.
An asset has a kind
attribute associated with it, which can be one of:
file
- an actual file associated with the deploymentsymlink
- a symbolic link to another file in the deployment
File assets also have a content
property, which as you might imagine, is the
actual contents of the file. These assets also have an encoding
property,
which indicates whether the content is encoded as utf-8
(plain text) or
base64
for
base64 encoded content.
To prevent the need to re-upload files that very seldom change, you can also
specify a gitSha1
attribute, which is a SHA-1
hash of the content that was
previously uploaded for the specified asset.
Below is an example of assets
that could be used to set up a deployment.
{
"assets": {
"main.ts": {
"kind": "file",
"content": "Deno.serve((req: Request) => new Response(\"Hello World\"));",
"encoding": "utf-8"
},
"images/cat1.png": {
"kind": "file",
"content": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk",
"encoding": "base64"
},
"images/cat2.png": {
"kind": "file",
"gitSha1": "5c4f8729e5c30a91a890e24d7285e89f418c637b"
},
"symlink.png": {
"kind": "symlink",
"target": "images/cat1.png"
}
}
}