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: prepare:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
outputs: outputs:
targets: ${{ steps.targets.outputs.matrix }} targets: ${{ steps.generate.outputs.targets }}
steps: steps:
- -
name: Checkout name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- -
name: Matrix name: List targets
id: targets id: generate
run: | uses: docker/bake-action/subaction/list-targets@v5
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT with:
target: validate
validate: validate:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@ -74,9 +74,9 @@ RUN --mount=type=bind,target=.,rw \
--mount=type=cache,target=/src/node_modules \ --mount=type=cache,target=/src/node_modules \
yarn run lint yarn run lint
FROM docker:${DOCKER_VERSION} as docker FROM docker:${DOCKER_VERSION} AS docker
FROM docker/buildx-bin:${BUILDX_VERSION} as buildx FROM docker/buildx-bin:${BUILDX_VERSION} AS buildx
FROM crazymax/undock:${UNDOCK_VERSION} as undock FROM crazymax/undock:${UNDOCK_VERSION} AS undock
FROM deps AS test FROM deps AS test
RUN --mount=type=bind,target=.,rw \ RUN --mount=type=bind,target=.,rw \

View File

@ -21,7 +21,7 @@ group "pre-checkin" {
} }
group "validate" { group "validate" {
targets = ["lint", "vendor-validate", "license-validate"] targets = ["lint", "vendor-validate", "dockerfile-validate", "license-validate"]
} }
target "build" { target "build" {
@ -54,6 +54,18 @@ target "vendor-validate" {
output = ["type=cacheonly"] 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" { target "test" {
dockerfile = "dev.Dockerfile" dockerfile = "dev.Dockerfile"
target = "test" target = "test"