name: Build Docker image on: schedule: - cron: 0 12 */7 * * push: paths: - '.github/workflows/build-images.yml' - 'linux/**' pull_request: paths: - '.github/workflows/build-images.yml' - 'linux/**' workflow_dispatch: env: NODE: '12' jobs: build: name: Build runs-on: ubuntu-20.04 if: ${{ github.actor == github.repository_owner && github.event_name != 'pull_request' }} strategy: fail-fast: true max-parallel: 4 matrix: DISTRIB_ID: [ubuntu] DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04] IMAGE_TYPE: [act, runner] steps: - name: Login to GitHub Container Registry id: ghcr if: ${{ github.actor == github.repository_owner }} uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Login to Quay id: quay if: ${{ github.actor == github.repository_owner }} uses: docker/login-action@v1 with: registry: quay.io username: ${{ secrets.QUAY_USER }} password: ${{ secrets.QUAY_TOKEN }} - name: Login to Docker Hub id: dckr if: ${{ github.actor == github.repository_owner }} uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USER }} password: ${{ secrets.DOCKER_TOKEN }} - name: Print date in UTC format id: print-date run: echo "::set-output name=date::$(date +%Y%m%d)" - name: Set Ubuntu version to RELEASE id: release run: | if [ "latest" = "${{ matrix.DISTRIB_RELEASE }}" ]; then echo "::set-output name=RELEASE::20.04" else echo "::set-output name=RELEASE::${{ matrix.DISTRIB_RELEASE }}" fi - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - uses: actions/checkout@v2 - name: Build and push ${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}-${{ steps.print-date.outputs.date }} id: docker_build uses: docker/build-push-action@v2 with: context: . push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }} file: ./linux/${{ matrix.DISTRIB_ID }}/${{ matrix.IMAGE_TYPE }}/Dockerfile platforms: linux/amd64,linux/arm64 tags: | ghcr.io/${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} ghcr.io/${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}-${{ steps.print-date.outputs.date }} quay.io/${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} quay.io/${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}-${{ steps.print-date.outputs.date }} docker.io/${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} docker.io/${{ github.repository_owner }}/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}-${{ steps.print-date.outputs.date }} build-args: | DISTRIB_ID=${{ matrix.DISTRIB_ID }} DISTRIB_RELEASE=${{ steps.release.outputs.RELEASE }} NODE_VERSION=${{ env.NODE }} BUILD_TAG_VERSION=${{ steps.print-date.outputs.date }} BUILD_TAG=${{ matrix.IMAGE_TYPE }} BUILD_REF=${{ github.sha }}