Skip to content

fix: multi-plaform builds #25

fix: multi-plaform builds

fix: multi-plaform builds #25

name: Build and Push Docker Image
on:
push:
branches:
- main
paths:
- 'Dockerfile'
- '.github/workflows/build_and_push_docker_image.yml'
pull_request:
branches:
- main
types:
- opened
- synchronize
- reopened
paths:
- 'Dockerfile'
- '.github/workflows/build_and_push_docker_image.yml'
concurrency:
group: "${{ github.workflow }}-${{ github.ref_name }}-${{ github.event_name }}"
cancel-in-progress: true
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
DEBIAN_TAG: ["trixie", "trixie-slim", "bullseye", "bullseye-slim", "buster", "buster-slim", "bookworm-slim", "bookworm"]
OPENCV_VERSION: ["4.9.0", "4.8.1", "4.8.0", "4.7.0" ]
# OPENCV_VERSION: ["4.9.0", "4.8.1", "4.8.0", "4.7.0", "4.6.0", "4.5.5", "4.5.4", "4.5.3", "4.5.2", "4.5.1", "4.5.0", "4.4.0", "4.3.0", "4.2.0", "4.1.2", "4.1.1", "4.1.0", "4.0.1", "4.0.0"]
GO_VERSION: ["1.22.1", "1.22.0", "1.21.8", "1.21.7", "1.21.6", "1.21.5", "1.21.4", "1.21.3"]
steps:
- name: Checkout Repo
uses: actions/checkout@v4.1.2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3.2.0
- name: Login to DockerHub
if: github.event_name == 'push'
uses: docker/login-action@v3.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and Push Docker image
uses: docker/build-push-action@v5.3.0
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: ${{ github.event_name == 'push' }}
tags: makepad/go-opencv:${{ matrix.DEBIAN_TAG }}-opencv-${{ matrix.OPENCV_VERSION }}-go${{ matrix.GO_VERSION }}
build-args: |
DEBIAN_TAG=${{ matrix.DEBIAN_TAG }}
OPENCV_VERSION=${{ matrix.OPENCV_VERSION }}
GO_VERSION=${{ matrix.GO_VERSION }}
cache-from: type=registry,ref=makepad/go-opencv:${{ matrix.DEBIAN_TAG }}-opencv-${{ matrix.OPENCV_VERSION }}-go${{ matrix.GO_VERSION }}
cache-to: type=inline