hadolint / hadolint-action

GitHub action for Hadolint, A Dockerfile linting tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

withBinaryFile: does not exist (No such file or directory)

pantelis-karamolegkos opened this issue · comments

I have the following Dockerfile

FROM golang:1.19 AS builder

ARG WDIR=myapp
ARG VERSION

COPY . ${WDIR}

WORKDIR ${WDIR}

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
    go build -a \
    --ldflags="-X main.buildVersion=${VERSION} -s -w" \
    -o /myapp

FROM gcr.io/myregistry/base/golang/alpine/1.19:stable

COPY --from=builder /myapp /bin/myapp

CMD ["/bin/myapp"]

This fails the lint with:

hadolint: ./myapp/Dockerfile: withBinaryFile: does not exist (No such file or directory)

The Dockerfile works as expected though

Could it be the reason that there is no Dockerfile in the root of the project?

Same issue here

my .pre-commit.yaml file

repos:
  - repo: https://github.com/hadolint/hadolint
    rev: v2.12.0
    hooks:
      - id: hadolint-docker

output

Lint Dockerfiles.........................................................Failed
- hook id: hadolint-docker
- exit code: 1

hadolint: Dockerfile.template: withBinaryFile: does not exist (No such file or directory)
hadolint: latest/Dockerfile.tws: withBinaryFile: does not exist (No such file or directory)

The files stated on the output are there, and the linter can find them. however it fails.

If I change my pre-commit config file to

repos:
  - repo: https://github.com/hadolint/hadolint
    rev: v2.12.0
    hooks:
      - id: hadolint

it works fine