Skip to content

Commit 3f9b10a

Browse files
authored
GH Actions: Build with buildah (#1)
1 parent 14303a3 commit 3f9b10a

File tree

2 files changed

+81
-2
lines changed

2 files changed

+81
-2
lines changed

.github/workflows/buildah.yml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Build dnsmasq oci container image
2+
3+
on:
4+
push:
5+
branches:
6+
- gh-actions
7+
workflow_dispatch:
8+
inputs:
9+
custom_tag:
10+
description: optional custom tag on remote repo you want image to be tagged with
11+
required: false
12+
default: 'latest'
13+
type: string
14+
15+
env:
16+
# Use docker.io for Docker Hub if empty
17+
REGISTRY: quay.io
18+
IMAGE_NAME: 3scale/dnsmasq
19+
20+
jobs:
21+
buildah:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Log in to Red Hat Registry
25+
uses: redhat-actions/podman-login@v1
26+
with:
27+
registry: ${{ env.REGISTRY }}
28+
username: ${{ secrets.QUAY_USER_NAME }}
29+
password: ${{ secrets.QUAY_PASSWORD }}
30+
31+
- name: Meta
32+
id: meta
33+
uses: docker/metadata-action@v5
34+
with:
35+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
36+
tags: |
37+
type=schedule
38+
type=ref,event=branch,enable=${{ github.ref_name != 'main' && inputs.custom_tag == '' }}
39+
type=raw,value=latest,enable=${{ github.ref_name == 'main' }}
40+
type=raw,value=nightly,enable=${{ github.ref_name == 'main' }}
41+
${{ inputs.custom_tag }}
42+
type=ref,event=tag
43+
type=ref,event=pr
44+
45+
- uses: actions/checkout@v4
46+
47+
- name: Build image
48+
id: build-image
49+
uses: redhat-actions/buildah-build@v2
50+
with:
51+
tags: ${{ steps.meta.outputs.tags }}
52+
labels: ${{ steps.meta.outputs.labels }}
53+
layers: false
54+
oci: true
55+
tls-verify: true
56+
extra-args: |
57+
--squash
58+
containerfiles: |
59+
Containerfile
60+
61+
- name: Echo Outputs
62+
run: |
63+
echo "Image: ${{ steps.build-image.outputs.image }}"
64+
echo "Tags: ${{ steps.build-image.outputs.tags }}"
65+
echo "Tagged Image: ${{ steps.build-image.outputs.image-with-tag }}"
66+
67+
- name: Check images created
68+
run: buildah images
69+
70+
- name: Push To quay.io
71+
id: push-to-quay
72+
uses: redhat-actions/push-to-registry@v2
73+
if: github.event_name != 'pull_request'
74+
with:
75+
tags: ${{ steps.build-image.outputs.tags }}
76+
77+
- name: Print image url
78+
run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}"
79+

Containerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
FROM registry.access.redhat.com/ubi9/ubi
2+
13
LABEL maintainer="3scale system team <[email protected]>"
24
LABEL org.opencontainers.image.title="dnsmasq",
35
LABEL org.opencontainers.image.source="https://github.com/3scale/dnsmasq"
46
LABEL org.opencontainers.image.vendor="3scale"
57

6-
FROM registry.access.redhat.com/ubi9/ubi
7-
88
RUN dnf -y install dnsmasq
99
EXPOSE 53 67 69
1010
ENTRYPOINT ["/usr/sbin/dnsmasq"]

0 commit comments

Comments
 (0)