kiwix
This example shows how to save data during package create so that it can be loaded into a container running in a pod, in this case to initialize a Kiwix server to allow offline viewing of documentation and wiki pages.
By saving the Kiwix data to a container image, we can spin up an init container that will copy the data to the main container running Kiwix.
kind: ZarfPackageConfigmetadata: name: kiwix description: Zarf data loading with Kiwix (https://www.kiwix.org/en/) version: 3.5.0
components: - name: kiwix-serve required: true manifests: - name: kiwix-serve namespace: kiwix files: - manifests/deployment.yaml - manifests/service.yaml images: - ghcr.io/kiwix/kiwix-serve:3.5.0-2 imageArchives: - path: kiwix-data.tar images: - kiwix-data:local actions: onCreate: before: # Download a .zim file of a DevOps Stack Exchange snapshot so that it can placed in the image we're building - cmd: curl https://zarf-remote.s3.us-east-2.amazonaws.com/testdata/devops.stackexchange.com_en_all_2023-05.zim -o zim-data/devops.stackexchange.com_en_all_2023-05.zim # Below are some more examples of *.zim files of available content: # https://library.kiwix.org/?lang=eng # NOTE: If `zarf package create`ing regularly you should mirror content to a web host you control to be a friendly neighbor
# Build a container image containing the ZIM data file - cmd: docker build -t kiwix-data:local .
# Export the container image to a tar archive for use as an image archive - cmd: docker save kiwix-data:local -o kiwix-data.tar