Replace the 'mysql' options with 'db' options in build.sh

release/v1.15
Lance Ju 2014-04-16 00:54:02 +08:00
parent 8080beea85
commit 1f989d0b98
2 changed files with 20 additions and 16 deletions

View File

@ -1,25 +1,29 @@
# Configs of the docker images, you might have specify your own configs here. # Configs of the docker images, you might have specify your own configs here.
MYSQL_PASSWORD="YOUR_MYSQL_PASSWORD" # type of database, support 'mysql' and 'postgres'
MYSQL_RUN_NAME="YOUR_MYSQL_RUN_NAME" DB_TYPE="postgres"
DB_PASSWORD="YOUR_DB_PASSWORD"
DB_RUN_NAME="YOUR_DB_RUN_NAME"
HOST_PORT="YOUR_HOST_PORT" HOST_PORT="YOUR_HOST_PORT"
# Replace the mysql root password in MySQL image Dockerfile. # Replace the database root password in database image Dockerfile.
sed -i "s/THE_MYSQL_PASSWORD/$MYSQL_PASSWORD/g" images/mysql/Dockerfile sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
# Replace the mysql root password in gogits image Dockerfile. # Replace the database root password in gogits image deploy.sh file.
sed -i "s/THE_MYSQL_PASSWORD/$MYSQL_PASSWORD/g" images/gogits/deploy.sh 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 # Build the database image
cd images/mysql cd images/$DB_TYPE
docker build -t gogs/mysql . docker build -t gogs/$DB_TYPE .
# #
## Build the gogits image ## Build the gogits image
cd ../gogits cd ../gogits
docker build -t gogs/gogits . docker build -t gogs/gogits .
# #
## Run MySQL image with name ## 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 ## Run gogits image and link it to the database image
echo "Now we have the MySQL image(running) and gogs image, use the follow command to start gogs service:" 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 $MYSQL_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m" echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m"

View File

@ -1,6 +1,6 @@
# Configs of the docker images, you might have specify your own configs here. # Configs of the docker images, you might have specify your own configs here.
# type of database, support 'mysql' and 'postgres' # type of database, support 'mysql' and 'postgres'
DB_TYPE="mysql" DB_TYPE="postgres"
DB_PASSWORD="YOUR_DB_PASSWORD" DB_PASSWORD="YOUR_DB_PASSWORD"
DB_RUN_NAME="YOUR_DB_RUN_NAME" DB_RUN_NAME="YOUR_DB_RUN_NAME"
HOST_PORT="YOUR_HOST_PORT" 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 sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
# Replace the database root password in gogits image deploy.sh file. # Replace the database root password in gogits image deploy.sh file.
sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/gogits/deploy.sh
# Replace the database type in gogits image Dockerfile. # Replace the database type in gogits image deploy.sh file.
sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/Dockerfile sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh
# Build the database image # Build the database image
cd images/$DB_TYPE cd images/$DB_TYPE