[CentOS] Write content to file from Dockerfile and/or any other method

Fri Jan 29 05:18:10 UTC 2016
reynierpm at gmail.com <reynierpm at gmail.com>

I am building a Dockerfile and I am setting up MariaDB repos as follow:

# Setup MariaDB repos
RUN touch /etc/yum.repos.d/MariaDB.repo

I should write this inside the MariaDB.repo file:
 name = MariaDB
 baseurl = http://yum.mariadb.org/5.5/centos6-amd64

What's the right way to do this? The one below?

echo "[mariadb]" >> "/etc/yum.repos.d/MariaDB.repo"
echo "name = MariaDB" >> "/etc/yum.repos.d/MariaDB.repo"
echo "baseurl = http://yum.mariadb.org/5.5/centos6-amd64" >>
echo "gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB" >>
echo "gpgcheck=1" >> "/etc/yum.repos.d/MariaDB.repo"