Sets up separate docker build for arm

This commit is contained in:
benbierens 2023-05-04 15:06:09 +02:00
parent 977e62b34d
commit 20ff017b89
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
1 changed files with 42 additions and 9 deletions

View File

@ -9,7 +9,7 @@ on:
workflow_dispatch: workflow_dispatch:
jobs: jobs:
docker: docker-amd64:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
@ -18,14 +18,10 @@ jobs:
id: meta id: meta
uses: docker/metadata-action@v4 uses: docker/metadata-action@v4
with: with:
images: thatbenbierens/nim-codex images: thatbenbierens/nim-codex-amd64
tags: | tags: |
type=semver,pattern={{version}} type=semver,pattern={{version}}
type=sha type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub - name: Login to Docker Hub
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
uses: docker/login-action@v2 uses: docker/login-action@v2
@ -37,11 +33,49 @@ jobs:
with: with:
context: . context: .
file: docker/codex.Dockerfile file: docker/codex.Dockerfile
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Minify docker image
uses: kitabisa/docker-slim-action@v1
env:
DSLIM_HTTP_PROBE: false
with:
target: ${{ steps.meta.outputs.labels }}
tag: ${{ steps.meta.outputs.tags }}
- name: Push image to docker registry
run: docker image push "${{ steps.meta.outputs.labels }}:${{ steps.meta.outputs.tags }}"
if: github.event_name != 'pull_request'
docker-arm64:
runs-on: buildjet-2vcpu-ubuntu-2204-arm
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: thatbenbierens/nim-codex-arm64
tags: |
type=semver,pattern={{version}}
type=sha
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: docker/codex.Dockerfile
platforms: linux/arm64
push: false push: false
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
# Slim it!
- name: Minify docker image - name: Minify docker image
uses: kitabisa/docker-slim-action@v1 uses: kitabisa/docker-slim-action@v1
env: env:
@ -49,7 +83,6 @@ jobs:
with: with:
target: ${{ steps.meta.outputs.labels }} target: ${{ steps.meta.outputs.labels }}
tag: ${{ steps.meta.outputs.tags }} tag: ${{ steps.meta.outputs.tags }}
# Push to the docker registry
- name: Push image to docker registry - name: Push image to docker registry
run: docker image push "${{ steps.meta.outputs.labels }}:${{ steps.meta.outputs.tags }}" run: docker image push "${{ steps.meta.outputs.labels }}:${{ steps.meta.outputs.tags }}"
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'