How to Include Static Files

Functions are blocks of code that run on demand without the need to manage any infrastructure. Develop on your local machine, test your code from the command line (using doctl), then deploy to a production namespace or App Platform — no servers required. Learn more about functions.

Node.js, Python, and PHP functions include all the files in their directory when deployed. Functions written in Go must use the embed package to refer to these files.

Including Files in Node.js, Python, and PHP

By default, all files in a Node.js, Python, or PHP function’s directory are included in the deployed function. These files can be opened and used by the function as you would normally.

Use .ignore and .include files to exclude or include certain files during the build process. You might do this to keep the size down on your deployed function, which can increase cold-start performance.

To learn more about .ignore and .include files, and the entire build process, see the .ignore and .include sections of the Build Process Reference.

Including Files in Go

To include files with your deployed Go function, you must use the embed package. The files to be embedded must be placed in function directory. See the Go runtime reference for more details and example code.