Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support heredocs in the validator for COPY instructions #112

Closed
rcjsuen opened this issue Aug 2, 2022 · 4 comments
Closed

Support heredocs in the validator for COPY instructions #112

rcjsuen opened this issue Aug 2, 2022 · 4 comments
Assignees

Comments

@rcjsuen
Copy link
Owner

rcjsuen commented Aug 2, 2022

# syntax=docker/dockerfile:1
FROM alpine
COPY <<-EOT /test.txt

	hello
EOT
$ DOCKER_BUILDKIT=1 docker build --no-cache .
[+] Building 1.4s (11/11) FINISHED                                                                                                                  
 => [internal] load build definition from Dockerfile                                                                                           0.0s
 => => transferring dockerfile: 111B                                                                                                           0.0s
 => [internal] load .dockerignore                                                                                                              0.0s
 => => transferring context: 2B                                                                                                                0.0s
 => resolve image config for docker.io/docker/dockerfile:1                                                                                     0.2s
 => CACHED docker-image://docker.io/docker/dockerfile:1@sha256:443aab4ca21183e069e7d8b2dc68006594f40bddf1b15bbd83f5137bd93e80e2                0.0s
 => [internal] load .dockerignore                                                                                                              0.0s
 => [internal] load build definition from Dockerfile                                                                                           0.0s
 => [internal] load metadata for docker.io/library/alpine:latest                                                                               0.1s
 => [internal] preparing inline document                                                                                                       0.0s
 => CACHED [1/2] FROM docker.io/library/alpine@sha256:7580ece7963bfa863801466c0a488f11c86f85d9988051a9f9c68cb27f6b7872                         0.0s
 => [2/2] COPY <<-EOT /test.txt                                                                                                                0.1s
 => exporting to image                                                                                                                         0.0s
 => => exporting layers                                                                                                                        0.0s
 => => writing image sha256:343ade6b67057dd6a97753767c3469acbb99d6cbe9ce56df330d31813fb5f82d                                                   0.0s
const lib = require("dockerfile-utils");
const content = `# syntax=docker/dockerfile:1
FROM alpine
COPY <<-EOT /test.txt

	hello
EOT`;
const edits = lib.validate(content);
console.log(edits.length);
1

Heredocs are not currently supported for COPY instructions so we end up flagging empty continuation lines in them. This is the COPY version of #107.

@ohmer
Copy link

ohmer commented Aug 23, 2022

Got the same issue. Is there a known workaround?

How can I help to get this done? Not fluent in JS/TS unfortunately...

@rcjsuen
Copy link
Owner Author

rcjsuen commented Aug 24, 2022

How can I help to get this done?

@ohmer This has been resolved now. I have released 0.11.0 which will allow the validator to ignore these empty continuation lines in COPY instructions.

@zffocussss
Copy link

How can I help to get this done?

@ohmer This has been resolved now. I have released 0.11.0 which will allow the validator to ignore these empty continuation lines in COPY instructions.

when will be published now?very preciate

@rcjsuen
Copy link
Owner Author

rcjsuen commented May 28, 2023

when will be published now?very preciate

0.11.0 was released in August of 2022 and I have just released a new version of dockerfile-language-server-nodejs today with this fix also if that was what you were waiting for. Apologies for the delay and I hope you have a great Sunday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants