name: Check if a Docker image can be built

on: [push, pull_request]

jobs:

  build_docker_image:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Build the Docker image
      run: |
        docker build . --tag ${{ github.repository }}
        docker images

    - name: Run tests inside the Docker container
      run: |
        ./test/server-start.sh

        docker run \
          --network=host \
          --security-opt seccomp=$(pwd)/chrome-seccomp.json \
          ${{ github.repository }} npm t

name: Check if a Docker image can be built

on: [push, pull_request]

jobs:

  build_docker_image:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1

    - name: Build the Docker image
      env:
        # @see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
        CACHE_IMAGE: macbre/phantomas:latest
      run: |
        docker pull $CACHE_IMAGE
        docker build . \
          --cache-from $CACHE_IMAGE \
          --tag ${{ github.repository }}
        docker images

    - name: Run tests inside the Docker container
      run: |
        ./test/server-start.sh

        docker run \
          --network=host \
          --security-opt seccomp=$(pwd)/chrome-seccomp.json \
          ${{ github.repository }} npm t

Use Docker layers cache to speed up CI builds
Use Docker layers cache to speed up CI builds

See https://testdriven.io/blog/faster-ci-builds-with-docker-cache/