From a6f5ade9656367cb37266d2811e613046afbac7c Mon Sep 17 00:00:00 2001 From: Daniel Ekman Date: Wed, 12 Apr 2023 09:30:37 +0200 Subject: [PATCH] Add workflow to build images, modify git/dockerignore Signed-off-by: Daniel Ekman --- .dockerignore | 2 ++ .github/workflows/container.yml | 59 +++++++++++++++++++++++++++++++++ .gitignore | 12 +++++++ 3 files changed, 73 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/container.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..d98024a --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +samples + diff --git a/.github/workflows/container.yml b/.github/workflows/container.yml new file mode 100644 index 0000000..f9d6972 --- /dev/null +++ b/.github/workflows/container.yml @@ -0,0 +1,59 @@ +name: Container Images + +on: + push: + branches: + - 'testing' + tags: + - 'v*' + pull_request: + workflow_dispatch: + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Calculate Container Metadata + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ github.repository }} + + - name: Setup QEMU + uses: docker/setup-qemu-action@v2 + + - name: Setup Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to GitHub Container Registry + if: ${{ github.event_name != 'pull_request' }} + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build Images + if: ${{ github.event_name == 'pull_request' }} + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7 + cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + - name: Build and Push Images + if: ${{ github.event_name != 'pull_request' }} + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64, linux/386, linux/arm64, linux/arm/v6, linux/arm/v7 + cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache + cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.gitignore b/.gitignore index 259148f..902ede2 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,15 @@ *.exe *.out *.app + +# Custom config file +user.env +user.cfg + +# IDE +.vscode +.idea + +# cmake +build +