redhat-actions / buildah-build

GitHub Action to use 'buildah' to build a container image.
https://github.com/marketplace/actions/buildah-build
MIT License
144 stars 34 forks source link

[QUESTION] How can I use a buildah script for image generation using GitHub Actions? #40

Closed EvanCarroll closed 3 years ago

EvanCarroll commented 3 years ago

Question

https://devops.stackexchange.com/questions/13524/how-can-i-use-a-buildah-script-for-image-generation-using-github-actions

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

#!/bin/sh
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?

divyansh42 commented 3 years ago

If your use case is satisfied by this action, you can use this action to build image and push-to-registry action to push to Github Container Registry (or registry of your choice). With this action you can also build image without dockerfile. Check this.

But, if you still want to build image typically using shell you can do something like this in your workflow:

- name: Test Build
  run: | 
    #!/bin/sh
    ctr=$(buildah from alpine:3)
    buildah commit "$ctr" my-alpine-image

As Github Linux runners comes with buildah pre-installed https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md#installed-software

Is this what you wanted to ask? or something else?

tetchel commented 3 years ago

closing pending any further comments