Unify docker build workflows

pull/228/head
Norman Gehrsitz 2024-10-05 16:31:21 +02:00
rodzic c4a429d734
commit 0171bc9572
4 zmienionych plików z 38 dodań i 127 usunięć

Wyświetl plik

@ -1,44 +0,0 @@
name: Publish Docker Intel GPU
on:
push:
branches:
- master
tags:
- v*
# Triggered by ODM build (after docker push)
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Use the repository information of the checked-out code to format docker tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: opendronemap/nodeodm
tag-semver: |
{{version}}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.gpu.intel
platforms: linux/amd64
push: true
tags: |
opendronemap/nodeodm:gpu.intel

Wyświetl plik

@ -1,44 +0,0 @@
name: Publish Docker GPU
on:
push:
branches:
- master
tags:
- v*
# Triggered by ODM build (after docker push)
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Use the repository information of the checked-out code to format docker tags
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: opendronemap/nodeodm
tag-semver: |
{{version}}
- name: Build and push Docker image
id: docker_build
uses: docker/build-push-action@v6
with:
file: ./Dockerfile.gpu
platforms: linux/amd64
push: true
tags: |
opendronemap/nodeodm:gpu

Wyświetl plik

@ -1,4 +1,4 @@
name: Publish Docker
name: Build, Test and Publish Docker
on:
push:
@ -6,12 +6,26 @@ on:
- master
tags:
- v*
pull_request:
# Triggered by ODM build (after docker push)
workflow_dispatch:
jobs:
build:
strategy:
matrix:
variant:
- dockerfile: ./Dockerfile
platforms: linux/amd64,linux/arm64
tag: latest
- dockerfile: ./Dockerfile.gpu
platforms: linux/amd64
tag: gpu
- dockerfile: ./Dockerfile.gpu.intel
platforms: linux/amd64
tag: gpu.intel
name: build ${{ matrix.variant.dockerfile }}
runs-on: ubuntu-latest
steps:
- name: Checkout
@ -33,13 +47,30 @@ jobs:
images: opendronemap/nodeodm
tag-semver: |
{{version}}
- name: Build and push Docker image
- name: Build and export Docker image
id: docker_build
uses: docker/build-push-action@v6
with:
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
file: ${{ matrix.variant.dockerfile }}
# exporting is only supported for the native platform
# avoid rebuilding after the test
cache-to: type=gha,mode=max
# make the image available to the docker command
load: true
tags: |
${{ matrix.variant.tag == 'latest' && steps.docker_meta.outputs.tags || '' }}
opendronemap/nodeodm:${{ matrix.variant.tag }}
- name: Test Powercycle
run: |
docker run --rm ${{ steps.docker_build.outputs.imageid }} --powercycle
- name: Push cached Docker image
uses: docker/build-push-action@v6
if: github.event_name != 'pull_request'
with:
file: ${{ matrix.variant.dockerfile }}
platforms: ${{ matrix.variant.platforms }}
cache-from: type=gha
push: true
tags: |
${{ steps.docker_meta.outputs.tags }}
opendronemap/nodeodm:latest
${{ matrix.variant.tag == 'latest' && steps.docker_meta.outputs.tags || '' }}
opendronemap/nodeodm:${{ matrix.variant.tag }}

Wyświetl plik

@ -1,32 +0,0 @@
name: Build PRs
on:
pull_request:
jobs:
docker:
runs-on: ubuntu-latest
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: localhost:5000/opendronemap/nodeodm:test
- name: Test Powercycle
run: |
docker run --rm localhost:5000/opendronemap/nodeodm:test --powercycle