Skip to content

Autoformatting breaks Dockerfile with heredoc (for COPY instruction) #3950

@moha-gh

Description

@moha-gh

Hi,

I have a problem that is very similar to #3327. Using v1.25.1 of the extension, a simple Dockerfile that uses heredocs in COPY instructions like this:

FROM alpine:3.18

COPY <<EOF /foo/bar
x
y
z
EOF

COPY <<EOF /bar/foo
a
b
c
EOF

is re-formatted to

FROM alpine:3.18

COPY <<EOF /foo/bar
    x
    y
    z
    EOF

COPY <<EOF /bar/foo
    a
    b
    c
    EOF

which breaks things completely (due to the indentation of the EOF marker).

From the previously mentioned bug report I gather that https://github.com/rcjsuen/dockerfile-utils is used for formatting. If I use the latest upstream release (0.11.0) via docker run rcjsuen/dockerfile-utils, the file is formatted correctly.

Would it be possible to pull in the newer version? Between 0.9.0 which is in use right now AFAIU and 0.11.0 there have been a number of heredoc-related fixes (see here) - and other as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions