Apko YAML is a declarative language used by the Apko command-line tool to build container images. It is based on the YAML (YAML Ain’t Markup Language) data serialization standard, which is human-readable and easy to write and understand.
The yaml
library in Node.js can be used to parse and stringify YAML data for Apko. This library supports both YAML 1.1 and YAML 1.2 and all common data schemas. It is released under the ISC open source license and has no external dependencies.
To use Apko YAML, you can write a YAML file that defines the sources and packages you want to include in your image. For example, you can define a list of apk repositories and a list of packages to install. You can also define an entry point command for your image.
Here’s an example of an Apko YAML file:
repositories:
- https://dl-cdn.alpinelinux.org/alpine/edge/main
packages:
- alpine-base
entrypoint:
command: /usr/bin/php81
This YAML file defines an Alpine-based image with the alpine-base
package installed and the php81
command as the entry point.
To build an image using this YAML file, you can run the following command:
apko build my-image.yaml
This will build a container image based on the specified YAML file. The resulting image will have the defined repositories added, the specified packages installed, and the specified entry point command.
Apko YAML provides a simple and declarative way to build container images using the Apko command-line tool. It is an essential part of the Apko ecosystem and is used to define the requirements and configuration of your container images.