Skip to content

Example in how to build an image using melange and apko

License

Notifications You must be signed in to change notification settings

cpanato/hello-wolfi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hello-wolfi Golang server

Demo Steps Overview

These steps were executed on an Ubuntu 22.04 host Linux machine and MacOSX.

  1. Make sure you have Docker installed on your machine
  2. Download the cgr.dev/chainguard/melange and cgr.dev/chainguard/apko images with docker pull
  3. Generate melange signing keys
  4. Build the melange.yaml package
  5. Build the apko.yaml container image
  6. Load the image with docker load
  7. Run the image with docker run --rm <image-name>

Detailed Steps

Download melange and apko images

docker pull cgr.dev/chainguard/melange
docker pull cgr.dev/chainguard/apko

Generate melange signing keys

docker run --rm -v "${PWD}":/work cgr.dev/chainguard/melange keygen

Build the go app package

docker run --privileged --rm -v "${PWD}":/work -- \
  cgr.dev/chainguard/melange build melange.yaml \
  --arch x86_64 \
  --signing-key melange.rsa --keyring-append melange.rsa.pub

Build the container image

docker run --rm -v ${PWD}:/work cgr.dev/chainguard/apko build --debug apko.yaml hello-wolfi:latest hello-wolfi.tar -k melange.rsa.pub

Load the container image

docker load < hello-wolfi.tar

Run the image

docker run --rm -p 8080:8080 hello-wolfi

In another shell:

curl http://localhost:8080