Skip to content

Commit b8c990a

Browse files
Merge pull request #125 from devops-infra/feature/multi-platform
Add support for arm64 images and multi-platform builds
2 parents 2daa179 + 15f23df commit b8c990a

File tree

8 files changed

+172
-108
lines changed

8 files changed

+172
-108
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 10 deletions
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

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,28 @@ 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-
34+

.github/workflows/PUSH-MASTER.yml

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ 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:
1313
- name: Checkout repository
1414
uses: actions/checkout@v4
1515

16-
- name: Download labels' config
16+
- name: Labels' config
1717
shell: bash
1818
run: |
1919
mkdir -p .tmp
@@ -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

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,72 +7,82 @@ 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

16-
- name: Download labels' config
16+
- name: Labels' config
1717
shell: bash
1818
run: |
1919
mkdir -p .tmp
2020
curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/.github/labels.yml -o .tmp/labels.yml
2121
22-
- name: Update labels - dry run
22+
- name: Update labels (dry run)
2323
uses: crazy-max/ghaction-github-labeler@v5.2.0
2424
with:
2525
github-token: ${{ secrets.GITHUB_TOKEN }}
2626
yaml-file: .tmp/labels.yml
2727
dry-run: true
2828

2929
lint:
30-
name: Run linters
30+
name: Linters
3131
if: "!startsWith(github.ref, 'refs/heads/dependabot')"
32-
runs-on: ubuntu-latest
32+
runs-on: ubuntu-24.04-arm
3333
steps:
34-
- name: Checkout repository
34+
- name: Checkout
3535
uses: actions/checkout@v4
3636

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

47-
build:
48-
name: Build image
49-
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
5046
steps:
51-
- name: Checkout repository
47+
- name: Checkout
5248
uses: actions/checkout@v4
5349

54-
- 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
5562
env:
63+
DOCKER_BUILDKIT: 1
64+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5666
TERM: xterm-256color
57-
run: make build
67+
run: make push VERSION_PREFIX=test-
5868

5969
pull_request:
6070
name: Create Pull Request
61-
runs-on: ubuntu-latest
71+
runs-on: ubuntu-24.04
6272
steps:
63-
- name: Checkout repository
73+
- name: Checkout
6474
uses: actions/checkout@v4
6575
with:
6676
fetch-depth: 0
6777

68-
- name: Download Pull Request template
78+
- name: Template
6979
shell: bash
7080
run: |
7181
mkdir -p .tmp
7282
curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/PULL_REQUEST_TEMPLATE.md -o .tmp/PULL_REQUEST_TEMPLATE.md
7383
74-
- name: Create pull request - bugfix (conditional)
75-
if: startsWith(github.ref, 'refs/heads/bugfix')
84+
- name: PR - bugfix (conditional)
85+
if: startsWith(github.ref, 'refs/heads/bug')
7686
uses: devops-infra/action-pull-request@v0.5.5
7787
with:
7888
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -81,8 +91,8 @@ jobs:
8191
template: .tmp/PULL_REQUEST_TEMPLATE.md
8292
get_diff: true
8393

84-
- name: Create pull request - dependency (conditional)
85-
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')"
8696
uses: devops-infra/action-pull-request@v0.5.5
8797
with:
8898
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -91,8 +101,8 @@ jobs:
91101
template: .tmp/PULL_REQUEST_TEMPLATE.md
92102
get_diff: true
93103

94-
- name: Create pull request - documentation (conditional)
95-
if: startsWith(github.ref, 'refs/heads/documentation')
104+
- name: PR - documentation (conditional)
105+
if: startsWith(github.ref, 'refs/heads/doc')
96106
uses: devops-infra/action-pull-request@v0.5.5
97107
with:
98108
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -101,8 +111,8 @@ jobs:
101111
template: .tmp/PULL_REQUEST_TEMPLATE.md
102112
get_diff: true
103113

104-
- name: Create pull request - feature (conditional)
105-
if: startsWith(github.ref, 'refs/heads/feature')
114+
- name: PR - feature (conditional)
115+
if: startsWith(github.ref, 'refs/heads/feat')
106116
uses: devops-infra/action-pull-request@v0.5.5
107117
with:
108118
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -111,7 +121,7 @@ jobs:
111121
template: .tmp/PULL_REQUEST_TEMPLATE.md
112122
get_diff: true
113123

114-
- name: Create pull request - test (conditional)
124+
- name: PR - test (conditional)
115125
if: startsWith(github.ref, 'refs/heads/test')
116126
uses: devops-infra/action-pull-request@v0.5.5
117127
with:
@@ -123,8 +133,8 @@ jobs:
123133
draft: true
124134
get_diff: true
125135

126-
- name: Create pull request - other (conditional)
127-
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')"
128138
uses: devops-infra/action-pull-request@v0.5.5
129139
with:
130140
github_token: ${{ secrets.GITHUB_TOKEN }}

Dockerfile

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Use a clean tiny image to store artifacts in
2-
FROM ubuntu:jammy-20240808
2+
FROM ubuntu:24.04
3+
4+
# Multi-architecture from buildx
5+
ARG TARGETPLATFORM
6+
7+
# Copy all needed files
8+
COPY entrypoint.sh /
9+
10+
# Install needed packages
11+
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
12+
# hadolint ignore=DL3008
13+
RUN chmod +x /entrypoint.sh ;\
14+
apt-get update -y ;\
15+
apt-get install --no-install-recommends -y \
16+
gpg-agent \
17+
software-properties-common ;\
18+
add-apt-repository ppa:git-core/ppa ;\
19+
apt-get update -y ;\
20+
apt-get install --no-install-recommends -y \
21+
git \
22+
git-lfs ;\
23+
apt-get clean ;\
24+
rm -rf /var/lib/apt/lists/*
25+
326

427
# Labels for http://label-schema.org/rc1/#build-time-labels
528
# And for https://github.com/opencontainers/image-spec/blob/master/annotations.md
@@ -8,7 +31,7 @@ ARG NAME="GitHub Action for committing changes to a repository"
831
ARG DESCRIPTION="GitHub Action that will create a new commit and push it back to the repository"
932
ARG REPO_URL="https://github.com/devops-infra/action-commit-push"
1033
ARG AUTHOR="Krzysztof Szyper / ChristophShyper / biotyk@mail.com"
11-
ARG HOMEPAGE="https://christophshyper.github.io/"
34+
ARG HOMEPAGE="https://shyper.pro"
1235
ARG BUILD_DATE=2020-04-01T00:00:00Z
1336
ARG VCS_REF=abcdef1
1437
ARG VERSION=v0.0
@@ -42,25 +65,6 @@ LABEL \
4265
maintainer="${AUTHOR}" \
4366
repository="${REPO_URL}"
4467

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-
gpg-agent \
55-
software-properties-common ;\
56-
add-apt-repository ppa:git-core/ppa ;\
57-
apt-get update -y ;\
58-
apt-get install --no-install-recommends -y \
59-
git \
60-
git-lfs ;\
61-
apt-get clean ;\
62-
rm -rf /var/lib/apt/lists/*
63-
6468
# Finish up
6569
WORKDIR /github/workspace
6670
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)