From 1f989d0b9881c8c0c3d0d1926fa9882dc880a141 Mon Sep 17 00:00:00 2001 From: Lance Ju Date: Wed, 16 Apr 2014 00:54:02 +0800 Subject: [PATCH] Replace the 'mysql' options with 'db' options in build.sh --- dockerfiles/build.sh | 30 +++++++++++++++++------------- dockerfiles/build.sh.bak | 6 +++--- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/dockerfiles/build.sh b/dockerfiles/build.sh index 1e7cf0ad0c..272424c872 100755 --- a/dockerfiles/build.sh +++ b/dockerfiles/build.sh @@ -1,25 +1,29 @@ # Configs of the docker images, you might have specify your own configs here. -MYSQL_PASSWORD="YOUR_MYSQL_PASSWORD" -MYSQL_RUN_NAME="YOUR_MYSQL_RUN_NAME" +# type of database, support 'mysql' and 'postgres' +DB_TYPE="postgres" +DB_PASSWORD="YOUR_DB_PASSWORD" +DB_RUN_NAME="YOUR_DB_RUN_NAME" HOST_PORT="YOUR_HOST_PORT" -# Replace the mysql root password in MySQL image Dockerfile. -sed -i "s/THE_MYSQL_PASSWORD/$MYSQL_PASSWORD/g" images/mysql/Dockerfile -# Replace the mysql root password in gogits image Dockerfile. -sed -i "s/THE_MYSQL_PASSWORD/$MYSQL_PASSWORD/g" images/gogits/deploy.sh +# Replace the database root password in database image Dockerfile. +sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile +# Replace the database root password in gogits image deploy.sh file. +sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh +# Replace the database type in gogits image deploy.sh file. +sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh -# Build the MySQL image -cd images/mysql -docker build -t gogs/mysql . +# Build the database image +cd images/$DB_TYPE +docker build -t gogs/$DB_TYPE . # ## Build the gogits image cd ../gogits docker build -t gogs/gogits . # ## Run MySQL image with name -docker run -d --name $MYSQL_RUN_NAME gogs/mysql +docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE # -## Run gogits image and link it to the MySQL image -echo "Now we have the MySQL image(running) and gogs image, use the follow command to start gogs service:" -echo -e "\033[33m docker run -i -t --link $MYSQL_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m" +## Run gogits image and link it to the database image +echo "Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:" +echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m" diff --git a/dockerfiles/build.sh.bak b/dockerfiles/build.sh.bak index 1617a1c527..272424c872 100755 --- a/dockerfiles/build.sh.bak +++ b/dockerfiles/build.sh.bak @@ -1,6 +1,6 @@ # Configs of the docker images, you might have specify your own configs here. # type of database, support 'mysql' and 'postgres' -DB_TYPE="mysql" +DB_TYPE="postgres" DB_PASSWORD="YOUR_DB_PASSWORD" DB_RUN_NAME="YOUR_DB_RUN_NAME" HOST_PORT="YOUR_HOST_PORT" @@ -9,8 +9,8 @@ HOST_PORT="YOUR_HOST_PORT" sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile # Replace the database root password in gogits image deploy.sh file. sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh -# Replace the database type in gogits image Dockerfile. -sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/Dockerfile +# Replace the database type in gogits image deploy.sh file. +sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh # Build the database image cd images/$DB_TYPE