I want to output the following text in a Dockerfile:
*****first row *****
*****second row *****
One way is to do it like that:
cat > Dockerfile <<EOF
FROM alpine:latest
RUN echo ' *****first row ***** ' >> /home/myfile
RUN echo ' *****second row ***** ' >> /home/myfile
ENTRYPOINT cat /home/myfile; sh;
WORKDIR /home
EOF
But if I have 100 lines it takes time because it runs each command separately and make it as a layer.
Other way is like that:
FROM alpine:latest
RUN printf ' *****first row ***** \n *****second row ***** \n' >> /home/myfile
ENTRYPOINT cat /home/myfile; sh;
WORKDIR /home
but I don't like it because it make it less readable, especially when you have 100 lines.
I wonder is there a way to do something like that:
FROM alpine:latest
RUN echo ' *****first row *****
*****second row ***** ' >> /home/myfile
ENTRYPOINT cat /home/myfile; sh;
WORKDIR /home
Or is there a way to use the ARG
command to do it ?