Merge pull request #479 from crazy-max/dockerfile-validate

dockerfile validation
This commit is contained in:
CrazyMax 2024-10-30 10:34:42 +01:00 committed by GitHub
commit e84b18afd5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 9 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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"