generated from devops-infra/template-action
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from devops-infra/feature/multi-arch
Add support for arm64 and multi-arch builds
- Loading branch information
Showing
8 changed files
with
181 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,27 @@ on: | |
|
||
jobs: | ||
build_and_push: | ||
name: Build and push images | ||
runs-on: ubuntu-latest | ||
name: Build & push | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image and push to registry | ||
- name: Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
install: true | ||
|
||
- name: QEMU | ||
uses: docker/[email protected] | ||
with: | ||
image: tonistiigi/binfmt:latest | ||
platforms: amd64,arm64 | ||
|
||
- name: Build & push | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TERM: xterm-256color | ||
run: make build | ||
run: make push VERSION_PREFIX=test- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,10 @@ on: | |
|
||
jobs: | ||
labels: | ||
name: Update repo labels | ||
runs-on: ubuntu-latest | ||
name: Repo labels | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download labels' config | ||
|
@@ -26,33 +26,40 @@ jobs: | |
yaml-file: .tmp/labels.yml | ||
|
||
lint: | ||
name: Run linters | ||
runs-on: ubuntu-latest | ||
name: Linters | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Lint | ||
uses: luke142367/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Haskell Dockerfile Linter (Hadolint) | ||
uses: brpaz/[email protected] | ||
- name: Hadolint | ||
uses: hadolint/[email protected] | ||
with: | ||
dockerfile: Dockerfile | ||
|
||
build_and_push: | ||
name: Build and push images | ||
name: Build & push | ||
needs: lint | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image and push to registry | ||
- name: Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
install: true | ||
|
||
- name: QEMU | ||
uses: docker/[email protected] | ||
with: | ||
image: tonistiigi/binfmt:latest | ||
platforms: amd64,arm64 | ||
|
||
- name: Build & push | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TERM: xterm-256color | ||
run: make build push | ||
run: make push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,76 +4,85 @@ on: | |
push: | ||
branches-ignore: | ||
- master | ||
- release/* | ||
|
||
jobs: | ||
labels: | ||
name: Update repo labels | ||
runs-on: ubuntu-latest | ||
name: Repo labels | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download labels' config | ||
- name: Labels' config | ||
shell: bash | ||
run: | | ||
mkdir -p .tmp | ||
curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/.github/labels.yml -o .tmp/labels.yml | ||
- name: Update labels - dry run | ||
- name: Update labels (dry run) | ||
uses: crazy-max/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
yaml-file: .tmp/labels.yml | ||
dry-run: true | ||
|
||
lint: | ||
name: Run linters | ||
name: Linters | ||
if: "!startsWith(github.ref, 'refs/heads/dependabot')" | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Docker Lint | ||
uses: luke142367/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Haskell Dockerfile Linter (Hadolint) | ||
uses: brpaz/[email protected] | ||
- name: Hadolint | ||
uses: hadolint/[email protected] | ||
with: | ||
dockerfile: Dockerfile | ||
|
||
build: | ||
name: Build image | ||
runs-on: ubuntu-latest | ||
build_and_push: | ||
name: Build & push | ||
if: "!startsWith(github.ref, 'refs/heads/dependabot')" | ||
runs-on: ubuntu-24.04-arm | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Build Docker image | ||
- name: Docker Buildx | ||
uses: docker/[email protected] | ||
with: | ||
install: true | ||
|
||
- name: QEMU | ||
uses: docker/[email protected] | ||
with: | ||
image: tonistiigi/binfmt:latest | ||
platforms: amd64,arm64 | ||
|
||
- name: Build & push | ||
env: | ||
DOCKER_BUILDKIT: 1 | ||
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TERM: xterm-256color | ||
run: make build | ||
run: make push VERSION_PREFIX=test- | ||
|
||
pull_request: | ||
name: Create Pull Request | ||
runs-on: ubuntu-latest | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout repository | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download Pull Request template | ||
- name: Template | ||
shell: bash | ||
run: | | ||
mkdir -p .tmp | ||
curl -LsS https://raw.githubusercontent.com/devops-infra/.github/master/PULL_REQUEST_TEMPLATE.md -o .tmp/PULL_REQUEST_TEMPLATE.md | ||
- name: Create pull request - bugfix (conditional) | ||
if: startsWith(github.ref, 'refs/heads/bugfix') | ||
- name: PR - bugfix (conditional) | ||
if: startsWith(github.ref, 'refs/heads/bug') | ||
uses: devops-infra/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -82,8 +91,8 @@ jobs: | |
template: .tmp/PULL_REQUEST_TEMPLATE.md | ||
get_diff: true | ||
|
||
- name: Create pull request - dependency (conditional) | ||
if: startsWith(github.ref, 'refs/heads/dependency') | ||
- name: PR - dependency (conditional) | ||
if: "startsWith(github.ref, 'refs/heads/dep') && !startsWith(github.ref, 'refs/heads/dependabot')" | ||
uses: devops-infra/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -92,8 +101,8 @@ jobs: | |
template: .tmp/PULL_REQUEST_TEMPLATE.md | ||
get_diff: true | ||
|
||
- name: Create pull request - documentation (conditional) | ||
if: startsWith(github.ref, 'refs/heads/documentation') | ||
- name: PR - documentation (conditional) | ||
if: startsWith(github.ref, 'refs/heads/doc') | ||
uses: devops-infra/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -102,8 +111,8 @@ jobs: | |
template: .tmp/PULL_REQUEST_TEMPLATE.md | ||
get_diff: true | ||
|
||
- name: Create pull request - feature (conditional) | ||
if: startsWith(github.ref, 'refs/heads/feature') | ||
- name: PR - feature (conditional) | ||
if: startsWith(github.ref, 'refs/heads/feat') | ||
uses: devops-infra/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
@@ -112,7 +121,7 @@ jobs: | |
template: .tmp/PULL_REQUEST_TEMPLATE.md | ||
get_diff: true | ||
|
||
- name: Create pull request - test (conditional) | ||
- name: PR - test (conditional) | ||
if: startsWith(github.ref, 'refs/heads/test') | ||
uses: devops-infra/[email protected] | ||
with: | ||
|
@@ -124,8 +133,8 @@ jobs: | |
draft: true | ||
get_diff: true | ||
|
||
- name: Create pull request - other (conditional) | ||
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')" | ||
- name: PR - test (conditional) | ||
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')" | ||
uses: devops-infra/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
# Use a clean tiny image to store artifacts in | ||
FROM ubuntu:jammy-20240808 | ||
FROM ubuntu:24.04 | ||
|
||
# Disable interactive mode | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Multi-architecture from buildx | ||
ARG TARGETPLATFORM | ||
|
||
# Copy all needed files | ||
COPY entrypoint.sh / | ||
|
||
# Install needed packages | ||
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] | ||
# hadolint ignore=DL3008 | ||
RUN chmod +x /entrypoint.sh ;\ | ||
apt-get update -y ;\ | ||
apt-get install --no-install-recommends -y \ | ||
curl \ | ||
gpg-agent \ | ||
software-properties-common ;\ | ||
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections ;\ | ||
add-apt-repository ppa:git-core/ppa ;\ | ||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg ;\ | ||
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg ;\ | ||
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 ;\ | ||
apt-get update -y ;\ | ||
apt-get install --no-install-recommends -y \ | ||
git \ | ||
gh \ | ||
hub \ | ||
jq ;\ | ||
apt-get clean ;\ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Labels for http://label-schema.org/rc1/#build-time-labels | ||
# And for https://github.com/opencontainers/image-spec/blob/master/annotations.md | ||
|
@@ -8,7 +40,7 @@ ARG NAME="GitHub Action for creating Pull Requests" | |
ARG DESCRIPTION="GitHub Action that will create a pull request from the current branch" | ||
ARG REPO_URL="https://github.com/devops-infra/action-pull-request" | ||
ARG AUTHOR="Krzysztof Szyper / ChristophShyper / [email protected]" | ||
ARG HOMEPAGE="https://christophshyper.github.io/" | ||
ARG HOMEPAGE="https://shyper.pro" | ||
ARG BUILD_DATE=2020-04-01T00:00:00Z | ||
ARG VCS_REF=abcdef1 | ||
ARG VERSION=v0.0 | ||
|
@@ -42,31 +74,6 @@ LABEL \ | |
maintainer="${AUTHOR}" \ | ||
repository="${REPO_URL}" | ||
|
||
# Copy all needed files | ||
COPY entrypoint.sh / | ||
|
||
# Install needed packages | ||
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] | ||
# hadolint ignore=DL3008 | ||
RUN chmod +x /entrypoint.sh ;\ | ||
apt-get update -y ;\ | ||
apt-get install --no-install-recommends -y \ | ||
curl \ | ||
gpg-agent \ | ||
software-properties-common ;\ | ||
add-apt-repository ppa:git-core/ppa ;\ | ||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg ;\ | ||
chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg ;\ | ||
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 ;\ | ||
apt-get update -y ;\ | ||
apt-get install --no-install-recommends -y \ | ||
git \ | ||
gh \ | ||
hub \ | ||
jq ;\ | ||
apt-get clean ;\ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Finish up | ||
CMD ["hub version"] | ||
WORKDIR /github/workspace | ||
|
Oops, something went wrong.