Buildah scripts typically use shell. You can see an example of a script here,

ctr=$(buildah from alpine:3)
buildah commit "$ctr" myAlpineImage

Let's say I have such a shell script that produces an image "myAlpineImage". How can I use GitHub CI to automate the creation of this image, and preferably uploading it to GitHub Container Registry?

  • What have you tried so far? As it stands, this question is very broad, and by narrowing down the scope to solving what you've tried thus far, you will be much more likely to get an accurate response.
    – Preston Martin
    Mar 11, 2021 at 17:32
  • @PrestonMartin I self answered. Mar 11, 2021 at 20:02

1 Answer 1


Here is what I did, I create a Makefile that includes my own method of image creation,

.PHONY: image clean image-release
image: image-release

    cargo build --release
    buildah unshare ./image/distroless.sh release

    cargo -v clean

For this purpose the only thing that matters is the image created by ./image/distroless.sh matches the action (redhat-actions/push-to-registry) in the following flow. We'll continue using the name myAlpineImage as in the question,

name: Distroless Image Creation

    branches: [ master ]
    branches: [ master ]



    runs-on: ubuntu-latest

    - uses: actions/checkout@v2
    - name: Download and create image.
      run: make image-release
    - name: Push To Registry
      uses: redhat-actions/[email protected]
        image: myAlpineImage
        tags: latest
        registry: ghcr.io/evancarroll/project
        username: evancarroll
        password: ${{ secrets.GHCR_TOKEN }}

You can see here we make the call to make image-release which calls the buildah script and makes the image rootless.

Then I added the secret for GHCR_TOKEN to my repo. The token is generated in the "Settings / Developer settings / Personal access" tokens on github..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.