buildkit icon indicating copy to clipboard operation
buildkit copied to clipboard

Dockerfile heredocs in other RUN-like commands

Open jedevc opened this issue 4 years ago • 2 comments

Following up on #2132.

Heredocs are now supported in RUN commands - it might be nice to extend this support into other commands that use similar semantics:

For example, CMD:

CMD <<EOF
#!/usr/bin/env python
print("Hello world")
EOF

Similarly for ONBUILD:

ONBUILD RUN <<EOF
echo test
EOF
ONBUILD COPY <<EOF /dest
file contents
EOF

I also imagine the same would work well with HEALTHCHECK? Though I don't have much experience with that specific command.

This is mostly for the sake of consistency with RUN-like commands, but it's not too hard to imagine valid use cases that might call for this feature.

jedevc avatar Jun 12 '21 21:06 jedevc

It'd be quite cool for ENTRYPOINT

ENTRYPOINT <<EOF
#! /bin/bash
exec apache2-foreground
EOF

ciaranmcnulty avatar Jun 11 '22 16:06 ciaranmcnulty