When a command grows into a set of application settings or build steps, YAML puts those settings in a readable file. Indentation matters: spaces show which properties belong to which object. The meaning of the properties depends on the tool reading the file. section 7.1 section 16.1
Listing 7.1 A Docker Compose file to run the to-do app
services:
todo-web:
image: diamol/ch06-todo-list:2e
ports:
- "8020:80"
networks:
- app-net
networks:
app-net:
name: nat
external: true
In this Compose file, `services` and `networks` are top-level entries. The indented `todo-web` service specifies an image, a port mapping, and a network. `external: true` identifies `nat` as an existing Docker network. section 7.1
To try the Compose file, create the `nat` network if needed, then run `docker compose up` from the file’s directory. Compose reads the desired state and asks Docker to create the resources needed to run the app. section 7.1
Listing 16.3 A simple GitHub workflow to run a PowerShell script
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: build
working-directory: cicd
run: ./build.ps1
shell: pwsh
YAML also defines GitHub Actions workflows. Here, an indented `build` job runs on `ubuntu-latest`, checks out the repository, and runs `./build.ps1` with PowerShell. Keeping most build logic in the script makes it easier to run locally and move to another build provider than putting it all in provider-specific workflow steps. section 16.1















