Skip to content

Commit 62d993d

Browse files
Add support for arm64 and multi-arch builds
Push also images to GitHub Packages.
1 parent 17d706c commit 62d993d

File tree

8 files changed

+181
-116
lines changed

8 files changed

+181
-116
lines changed

.github/dependabot.yml

-10
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,3 @@ updates:
1919
- ChristophShyper
2020
labels:
2121
- automatic
22-
23-
# # Enable version updates for pip
24-
# - package-ecosystem: pip
25-
# directory: "/"
26-
# schedule:
27-
# interval: daily
28-
# assignees:
29-
# - ChristophShyper
30-
# labels:
31-
# - automatic

.github/workflows/CRON.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,27 @@ on:
77

88
jobs:
99
build_and_push:
10-
name: Build and push images
11-
runs-on: ubuntu-latest
10+
name: Build & push
11+
runs-on: ubuntu-24.04-arm
1212
steps:
13-
- name: Checkout repository
13+
- name: Checkout
1414
uses: actions/checkout@v4
1515

16-
- name: Build Docker image and push to registry
16+
- name: Docker Buildx
17+
uses: docker/setup-buildx-action@v3.9.0
18+
with:
19+
install: true
20+
21+
- name: QEMU
22+
uses: docker/setup-qemu-action@v3.4.0
23+
with:
24+
image: tonistiigi/binfmt:latest
25+
platforms: amd64,arm64
26+
27+
- name: Build & push
1728
env:
29+
DOCKER_BUILDKIT: 1
1830
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
1931
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2032
TERM: xterm-256color
21-
run: make build
33+
run: make push VERSION_PREFIX=test-

.github/workflows/PUSH-MASTER.yml

+25-18
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ on:
77

88
jobs:
99
labels:
10-
name: Update repo labels
11-
runs-on: ubuntu-latest
10+
name: Repo labels
11+
runs-on: ubuntu-24.04-arm
1212
steps:
13-
- name: Checkout repository
13+
- name: Checkout
1414
uses: actions/checkout@v4
1515

1616
- name: Download labels' config
@@ -26,33 +26,40 @@ jobs:
2626
yaml-file: .tmp/labels.yml
2727

2828
lint:
29-
name: Run linters
30-
runs-on: ubuntu-latest
29+
name: Linters
30+
runs-on: ubuntu-24.04-arm
3131
steps:
32-
- name: Checkout repository
32+
- name: Checkout
3333
uses: actions/checkout@v4
3434

35-
- name: Docker Lint
36-
uses: luke142367/Docker-Lint-Action@v1.1.1
37-
env:
38-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
40-
- name: Haskell Dockerfile Linter (Hadolint)
41-
uses: brpaz/hadolint-action@v1.5.0
35+
- name: Hadolint
36+
uses: hadolint/hadolint-action@v3.1.0
4237
with:
4338
dockerfile: Dockerfile
4439

4540
build_and_push:
46-
name: Build and push images
41+
name: Build & push
4742
needs: lint
48-
runs-on: ubuntu-latest
43+
runs-on: ubuntu-24.04-arm
4944
steps:
50-
- name: Checkout repository
45+
- name: Checkout
5146
uses: actions/checkout@v4
5247

53-
- name: Build Docker image and push to registry
48+
- name: Docker Buildx
49+
uses: docker/setup-buildx-action@v3.9.0
50+
with:
51+
install: true
52+
53+
- name: QEMU
54+
uses: docker/setup-qemu-action@v3.4.0
55+
with:
56+
image: tonistiigi/binfmt:latest
57+
platforms: amd64,arm64
58+
59+
- name: Build & push
5460
env:
61+
DOCKER_BUILDKIT: 1
5562
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
5663
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5764
TERM: xterm-256color
58-
run: make build push
65+
run: make push

.github/workflows/PUSH-OTHER.yml

+45-36
Original file line numberDiff line numberDiff line change
@@ -4,76 +4,85 @@ on:
44
push:
55
branches-ignore:
66
- master
7-
- release/*
87

98
jobs:
109
labels:
11-
name: Update repo labels
12-
runs-on: ubuntu-latest
10+
name: Repo labels
11+
runs-on: ubuntu-24.04-arm
1312
steps:
14-
- name: Checkout repository
13+
- name: Checkout
1514
uses: actions/checkout@v4
1615

17-
- name: Download labels' config
16+
- name: Labels' config
1817
shell: bash
1918
run: |
2019
mkdir -p .tmp
2120
curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/.github/labels.yml -o .tmp/labels.yml
2221
23-
- name: Update labels - dry run
22+
- name: Update labels (dry run)
2423
uses: crazy-max/ghaction-github-labeler@v5.2.0
2524
with:
2625
github-token: ${{ secrets.GITHUB_TOKEN }}
2726
yaml-file: .tmp/labels.yml
2827
dry-run: true
2928

3029
lint:
31-
name: Run linters
30+
name: Linters
3231
if: "!startsWith(github.ref, 'refs/heads/dependabot')"
33-
runs-on: ubuntu-latest
32+
runs-on: ubuntu-24.04-arm
3433
steps:
35-
- name: Checkout repository
34+
- name: Checkout
3635
uses: actions/checkout@v4
3736

38-
- name: Docker Lint
39-
uses: luke142367/Docker-Lint-Action@v1.1.1
40-
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42-
43-
- name: Haskell Dockerfile Linter (Hadolint)
44-
uses: brpaz/hadolint-action@v1.5.0
37+
- name: Hadolint
38+
uses: hadolint/hadolint-action@v3.1.0
4539
with:
4640
dockerfile: Dockerfile
4741

48-
build:
49-
name: Build image
50-
runs-on: ubuntu-latest
42+
build_and_push:
43+
name: Build & push
44+
if: "!startsWith(github.ref, 'refs/heads/dependabot')"
45+
runs-on: ubuntu-24.04-arm
5146
steps:
52-
- name: Checkout repository
47+
- name: Checkout
5348
uses: actions/checkout@v4
5449

55-
- name: Build Docker image
50+
- name: Docker Buildx
51+
uses: docker/setup-buildx-action@v3.9.0
52+
with:
53+
install: true
54+
55+
- name: QEMU
56+
uses: docker/setup-qemu-action@v3.4.0
57+
with:
58+
image: tonistiigi/binfmt:latest
59+
platforms: amd64,arm64
60+
61+
- name: Build & push
5662
env:
63+
DOCKER_BUILDKIT: 1
64+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5766
TERM: xterm-256color
58-
run: make build
67+
run: make push VERSION_PREFIX=test-
5968

6069
pull_request:
6170
name: Create Pull Request
62-
runs-on: ubuntu-latest
71+
runs-on: ubuntu-24.04
6372
steps:
64-
- name: Checkout repository
73+
- name: Checkout
6574
uses: actions/checkout@v4
6675
with:
6776
fetch-depth: 0
6877

69-
- name: Download Pull Request template
78+
- name: Template
7079
shell: bash
7180
run: |
7281
mkdir -p .tmp
7382
curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/PULL_REQUEST_TEMPLATE.md -o .tmp/PULL_REQUEST_TEMPLATE.md
7483
75-
- name: Create pull request - bugfix (conditional)
76-
if: startsWith(github.ref, 'refs/heads/bugfix')
84+
- name: PR - bugfix (conditional)
85+
if: startsWith(github.ref, 'refs/heads/bug')
7786
uses: devops-infra/action-pull-request@v0.5.5
7887
with:
7988
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -82,8 +91,8 @@ jobs:
8291
template: .tmp/PULL_REQUEST_TEMPLATE.md
8392
get_diff: true
8493

85-
- name: Create pull request - dependency (conditional)
86-
if: startsWith(github.ref, 'refs/heads/dependency')
94+
- name: PR - dependency (conditional)
95+
if: "startsWith(github.ref, 'refs/heads/dep') && !startsWith(github.ref, 'refs/heads/dependabot')"
8796
uses: devops-infra/action-pull-request@v0.5.5
8897
with:
8998
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -92,8 +101,8 @@ jobs:
92101
template: .tmp/PULL_REQUEST_TEMPLATE.md
93102
get_diff: true
94103

95-
- name: Create pull request - documentation (conditional)
96-
if: startsWith(github.ref, 'refs/heads/documentation')
104+
- name: PR - documentation (conditional)
105+
if: startsWith(github.ref, 'refs/heads/doc')
97106
uses: devops-infra/action-pull-request@v0.5.5
98107
with:
99108
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -102,8 +111,8 @@ jobs:
102111
template: .tmp/PULL_REQUEST_TEMPLATE.md
103112
get_diff: true
104113

105-
- name: Create pull request - feature (conditional)
106-
if: startsWith(github.ref, 'refs/heads/feature')
114+
- name: PR - feature (conditional)
115+
if: startsWith(github.ref, 'refs/heads/feat')
107116
uses: devops-infra/action-pull-request@v0.5.5
108117
with:
109118
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -112,7 +121,7 @@ jobs:
112121
template: .tmp/PULL_REQUEST_TEMPLATE.md
113122
get_diff: true
114123

115-
- name: Create pull request - test (conditional)
124+
- name: PR - test (conditional)
116125
if: startsWith(github.ref, 'refs/heads/test')
117126
uses: devops-infra/action-pull-request@v0.5.5
118127
with:
@@ -124,8 +133,8 @@ jobs:
124133
draft: true
125134
get_diff: true
126135

127-
- name: Create pull request - other (conditional)
128-
if: "!startsWith(github.ref, 'refs/heads/bugfix') && !startsWith(github.ref, 'refs/heads/dependabot') && !startsWith(github.ref, 'refs/heads/dependency') && !startsWith(github.ref, 'refs/heads/documentation') && !startsWith(github.ref, 'refs/heads/feature') && !startsWith(github.ref, 'refs/heads/test')"
136+
- name: PR - test (conditional)
137+
if: "!startsWith(github.ref, 'refs/heads/bug') && !startsWith(github.ref, 'refs/heads/dep') && !startsWith(github.ref, 'refs/heads/doc') && !startsWith(github.ref, 'refs/heads/feat') && !startsWith(github.ref, 'refs/heads/test')"
129138
uses: devops-infra/action-pull-request@v0.5.5
130139
with:
131140
github_token: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

+34-27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,37 @@
11
# Use a clean tiny image to store artifacts in
2-
FROM ubuntu:jammy-20240808
2+
FROM ubuntu:24.04
3+
4+
# Disable interactive mode
5+
ENV DEBIAN_FRONTEND noninteractive
6+
7+
# Multi-architecture from buildx
8+
ARG TARGETPLATFORM
9+
10+
# Copy all needed files
11+
COPY entrypoint.sh /
12+
13+
# Install needed packages
14+
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
15+
# hadolint ignore=DL3008
16+
RUN chmod +x /entrypoint.sh ;\
17+
apt-get update -y ;\
18+
apt-get install --no-install-recommends -y \
19+
curl \
20+
gpg-agent \
21+
software-properties-common ;\
22+
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections ;\
23+
add-apt-repository ppa:git-core/ppa ;\
24+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg ;\
25+
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg ;\
26+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null ;\
27+
apt-get update -y ;\
28+
apt-get install --no-install-recommends -y \
29+
git \
30+
gh \
31+
hub \
32+
jq ;\
33+
apt-get clean ;\
34+
rm -rf /var/lib/apt/lists/*
335

436
# Labels for http://label-schema.org/rc1/#build-time-labels
537
# And for https://github.com/opencontainers/image-spec/blob/master/annotations.md
@@ -8,7 +40,7 @@ ARG NAME="GitHub Action for creating Pull Requests"
840
ARG DESCRIPTION="GitHub Action that will create a pull request from the current branch"
941
ARG REPO_URL="https://github.com/devops-infra/action-pull-request"
1042
ARG AUTHOR="Krzysztof Szyper / ChristophShyper / biotyk@mail.com"
11-
ARG HOMEPAGE="https://christophshyper.github.io/"
43+
ARG HOMEPAGE="https://shyper.pro"
1244
ARG BUILD_DATE=2020-04-01T00:00:00Z
1345
ARG VCS_REF=abcdef1
1446
ARG VERSION=v0.0
@@ -42,31 +74,6 @@ LABEL \
4274
maintainer="${AUTHOR}" \
4375
repository="${REPO_URL}"
4476

45-
# Copy all needed files
46-
COPY entrypoint.sh /
47-
48-
# Install needed packages
49-
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
50-
# hadolint ignore=DL3008
51-
RUN chmod +x /entrypoint.sh ;\
52-
apt-get update -y ;\
53-
apt-get install --no-install-recommends -y \
54-
curl \
55-
gpg-agent \
56-
software-properties-common ;\
57-
add-apt-repository ppa:git-core/ppa ;\
58-
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg ;\
59-
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg ;\
60-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null ;\
61-
apt-get update -y ;\
62-
apt-get install --no-install-recommends -y \
63-
git \
64-
gh \
65-
hub \
66-
jq ;\
67-
apt-get clean ;\
68-
rm -rf /var/lib/apt/lists/*
69-
7077
# Finish up
7178
CMD ["hub version"]
7279
WORKDIR /github/workspace

0 commit comments

Comments
 (0)