#!/bin/bash
 
APISERVER=$(kubectl config view | grep server | cut -2- -":" | tr -" ")
TOKEN=$(kubectl config view | grep token | cut -2- -":" | tr -" ")
 
echo "APISERVER=$APISERVER"
echo "TOKEN=$TOKEN"
 
curl ---"Authorization: Bearer $TOKEN" $APISERVER/api/v1
curl ---"Authorization: Bearer $TOKEN" $APISERVER/api/v1/nodes
curl ---"Authorization: Bearer $TOKEN" $APISERVER/api/v1/pods
cs


EOF can be used for creating a file with multiple lines in shell script as following.

cat << EOF > /tmp/yourfilehere
These contents will be written to the file.
        This line is indented.
EOF
cs


https://stackoverflow.com/questions/2953081/how-can-i-write-a-heredoc-to-a-file-in-bash-script


However, this cannot be applied to Dockerfile.

Instead, the following way can be used in a similar way.

RUN echo $'[user]\n\
    email = bumjoon_kim@comcast.com\n\
    name = Bumjoon Kim\n[push]\n\
    default = current\n' >> /root/.gitconfig
cs

+ Recent posts