Skip to content

Autoformatting breaks Dockerfile with heredoc #3327

@wedi

Description

@wedi

Using the new heredoc syntax in Dockerfiles used to trigger error messages in VS Code but autoformatting did not interfere with it. Unfortunately this has changed (unfortunately I cannot tell when): since some time autoformatting indents the end marker and following lines which makes it impossible to use autoformatting on save.

This dockerfile

# syntax=docker/dockerfile:1.3-labs
FROM alpine
RUN <<EOF
    echo "Heredocs! Finally!"
EOF
CMD ["sh", "-c", "sleep 5"]

becomes

# syntax=docker/dockerfile:1.3-labs
FROM alpine
RUN <<EOF
    echo "Heredocs! Finally!"
    EOF
    CMD ["sh", "-c", "sleep 5"]

after formatting.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions