name: Build Docker image on: schedule: - cron: 0 12 * * * push: paths: - '.github/workflows/build-images.yml' - 'linux/**' pull_request: paths: - '.github/workflows/build-images.yml' - 'linux/**' workflow_dispatch: jobs: act-base: name: Build base docker images for act runs-on: ubuntu-latest strategy: fail-fast: false max-parallel: 12 matrix: DISTRIB_ID: [ubuntu] DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04] IMAGE_TYPE: [act, runner] NODE_VERSION: ['12'] steps: - 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 - name: Login to GitHub Container Registry if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }} uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GHCR_TOKEN }} - name: Login to Quay if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }} uses: docker/login-action@v1 with: registry: quay.io username: catthehacker+docker_images password: ${{ secrets.QUAY_TOKEN }} - name: Login to Docker Hub if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }} uses: docker/login-action@v1 with: username: catthehacker password: ${{ secrets.DCKR_TOKEN }} - name: Check which version is currently `ubuntu-latest` id: ubuntu_latest if: ${{ matrix.DISTRIB_RELEASE == 'latest' }} run: echo "::set-output name=UBUNTU_LATEST::$(lsb_release -sr)" - name: Build and push ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} id: docker_build_version uses: docker/build-push-action@v2 if: ${{ matrix.DISTRIB_RELEASE != 'latest' }} 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/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} quay.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} docker.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} build-args: | DISTRIB_ID=${{ matrix.DISTRIB_ID }} DISTRIB_RELEASE=${{ matrix.DISTRIB_RELEASE }} NODE_VERSION=${{ matrix.NODE_VERSION }} - name: Build and push ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} id: docker_build_latest uses: docker/build-push-action@v2 if: ${{ matrix.DISTRIB_RELEASE == 'latest' }} 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/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} quay.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} docker.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }} build-args: | DISTRIB_ID=${{ matrix.DISTRIB_ID }} DISTRIB_RELEASE=${{ steps.ubuntu_latest.outputs.UBUNTU_LATEST }} NODE_VERSION=${{ matrix.NODE_VERSION }} scan: runs-on: ubuntu-latest needs: - act-base strategy: max-parallel: 4 fail-fast: false matrix: DISTRIB_ID: [ubuntu] DISTRIB_RELEASE: [latest, 20.04, 18.04, 16.04] IMAGE_TYPE: [act, runner] steps: - uses: azure/container-scan@v0 with: image-name: ghcr.io/catthehacker/${{ matrix.DISTRIB_ID }}:${{ matrix.IMAGE_TYPE }}-${{ matrix.DISTRIB_RELEASE }}