docker / buildx

Docker CLI plugin for extended build capabilities with BuildKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

source snippet paths for warnings/errors should be relative to context/filename

tonistiigi opened this issue · comments

Buildkit does not see the full path of Dockerfile is context is a subdir or a local path is passed with -f.

Command like

docker buildx build --check ./src/ld 

Gives me warnings

WARNING: WorkdirRelativePath - https://docs.docker.com/go/dockerfile/rule/workdir-relative-path/
Relative workdir "./apple-libtapi" can have unexpected results if the base image changes
Dockerfile:19
--------------------
  17 |     ARG LIBTAPI_VERSION
  18 |     RUN git clone https://github.com/tpoechtrager/apple-libtapi --depth 1 -b ${LIBTAPI_VERSION}
  19 | >>> WORKDIR ./apple-libtapi
  20 |     RUN --mount=target=/tmp/libtapi-cmake-args.patch,source=libtapi-cmake-args.patch \
  21 |         git apply /tmp/libtapi-cmake-args.patch
--------------------

Note the Dockerfile:19 while the actual path to the Dockerfile is ./src/ld/Dockerfile:19. In this case it is especially confusing as there is another Dockerfile in root directory as well. This also makes debugging harder as for example VSCode can detect these paths and can directly open a correct line, but atm it would open a line from wrong file for this case.