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@v2
    - name: Set up QEMU
      uses: docker/setup-qemu-action@v1
    - name: Set up Docker Buildx
      uses: docker/setup-buildx-action@v1
      with:
          driver-opts: network=host
    - name: Build
      uses: docker/build-push-action@v2
      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
