Skip to content

Commit

Permalink
Split GitHub actions to multiple platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
philhawthorne committed Nov 27, 2023
1 parent bbad8a1 commit 00087ed
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker-arm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ARM Image Build
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_REGISTRY: hub.docker.com
DOCKER_IMAGE: philhawthorne/ha-dockermon
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_TARGET_PLATFORM: linux/arm/v7,linux/arm64
steps:
- name: Checkout the code
uses: actions/checkout@v1
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
version: latest
- name: Prepare
if: success()
id: prepare
run: |
echo "docker_platform=${DOCKER_TARGET_PLATFORM}" >> "$GITHUB_OUTPUT"
echo "docker_image=philhawthorne/ha-dockermon" >> "$GITHUB_OUTPUT"
echo "version=${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
- name: Docker Login
if: success()
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Push arm-tag
if: success()
run: |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:arm --file ./Dockerfile.RaspberryPi --output type=image,push=true .
- name: Push arm-latest tag
if: success()
run: |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }}:arm-latest --file ./Dockerfile.RaspberryPi --output type=image,push=true .
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Docker Build/Publish Image
name: Master Image Build
on:
push:
branches: [ master ]
Expand All @@ -10,7 +10,7 @@ jobs:
DOCKER_IMAGE: philhawthorne/ha-dockermon
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_TARGET_PLATFORM: linux/arm/v7
DOCKER_TARGET_PLATFORM: linux/amd64
steps:
- name: Checkout the code
uses: actions/checkout@v1
Expand All @@ -23,13 +23,13 @@ jobs:
id: prepare
run: |
echo "docker_platform=${DOCKER_TARGET_PLATFORM}" >> "$GITHUB_OUTPUT"
echo "docker_image=philhawthorne/ha-dockermon:json-arm" >> "$GITHUB_OUTPUT"
echo "docker_image=philhawthorne/ha-dockermon:latest" >> "$GITHUB_OUTPUT"
echo "version=${GITHUB_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
- name: Docker Login
if: success()
- name: Docker Login
if: success()
run: |
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Run Buildx (push image)
if: success()
run: |
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }} --file ./Dockerfile.RaspberryPi --output type=image,push=true .
docker buildx build --platform ${{ steps.prepare.outputs.docker_platform }} --tag ${{ steps.prepare.outputs.docker_image }} --file ./Dockerfile --output type=image,push=true .

0 comments on commit 00087ed

Please sign in to comment.