Skip to content

Commit

Permalink
Merge branch 'main' of github.com:element36-io/test-r0
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Strametz committed Mar 6, 2024
2 parents 65fcc87 + 4a4fded commit 1a0a53a
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 32 deletions.
52 changes: 32 additions & 20 deletions .github/workflows/build-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,54 @@
name: Docker Build
name: Buildx Action

on:
push

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64

# strategy:
# fail-fast: false
# matrix:
# # os:
# # - macos-latest # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs
# platform:
# - linux/arm64

steps:
-
name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
# - name: Prepare
# run: |
# platform=${{ matrix.platform }}
# echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV


- name: Check out code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
-
name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v3
# uses: crazy-max/ghaction-setup-containerd@v3

- name: Login to DockerHub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

-
name: Build and push by digest
name: Build
id: build
uses: docker/build-push-action@v5
with:
context: .
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
# platforms: ${{ matrix.platform }}
# labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},name-canonical=true,push=false

16 changes: 9 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
name: Docker Build
name: run.sh

on:
push

jobs:
build:
runs-on: ubuntu-latest
runs-on: macos-latest
permissions:
contents: write
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: actions/checkout@v3

-
name: Set up Docker
uses: crazy-max/ghaction-setup-docker@v3
# uses: crazy-max/ghaction-setup-containerd@v3

- name: Build Docker image (manual)
run: ./run.sh
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
12 changes: 7 additions & 5 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
set -e

# Define the GitHub token to get rid of binstall warning to rule this out as cause for error
GITHUB_TOKEN=$(gh auth token)

# Build the Docker image, passing the GitHub token as a build argument
docker buildx build . --progress=plain --build-arg GITHUB_TOKEN="$GITHUB_TOKEN"

if GITHUB_TOKEN=$(gh auth token); then
# Build the Docker image, passing the GitHub token as a build argument
docker buildx build . --build-arg GITHUB_TOKEN="$GITHUB_TOKEN"
else
# Build the Docker image without the GitHub token
docker buildx build .
fi
# Build for amd64 - works
#docker build --platform linux/amd64 .

Expand Down

0 comments on commit 1a0a53a

Please sign in to comment.