diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e7f23fe..5910c89 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -17,16 +17,17 @@ jobs: prepare: runs-on: ubuntu-20.04 outputs: - targets: ${{ steps.targets.outputs.matrix }} + targets: ${{ steps.generate.outputs.targets }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Matrix - id: targets - run: | - echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT + name: List targets + id: generate + uses: docker/bake-action/subaction/list-targets@v5 + with: + target: validate validate: runs-on: ubuntu-latest diff --git a/dev.Dockerfile b/dev.Dockerfile index e551ab5..0c0afb1 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -74,9 +74,9 @@ RUN --mount=type=bind,target=.,rw \ --mount=type=cache,target=/src/node_modules \ yarn run lint -FROM docker:${DOCKER_VERSION} as docker -FROM docker/buildx-bin:${BUILDX_VERSION} as buildx -FROM crazymax/undock:${UNDOCK_VERSION} as undock +FROM docker:${DOCKER_VERSION} AS docker +FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx +FROM crazymax/undock:${UNDOCK_VERSION} AS undock FROM deps AS test RUN --mount=type=bind,target=.,rw \ diff --git a/docker-bake.hcl b/docker-bake.hcl index bb4b1d0..184b6c4 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -21,7 +21,7 @@ group "pre-checkin" { } group "validate" { - targets = ["lint", "vendor-validate", "license-validate"] + targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"] } target "build" { @@ -54,6 +54,18 @@ target "vendor-validate" { output = ["type=cacheonly"] } +target "dockerfile-validate" { + matrix = { + dockerfile = [ + "dev.Dockerfile", + "./hack/dockerfiles/license.Dockerfile" + ] + } + name = "dockerfile-validate-${md5(dockerfile)}" + dockerfile = dockerfile + call = "check" +} + target "test" { dockerfile = "dev.Dockerfile" target = "test"