Build the database image by the variable DB_TYPE, but not mysql.
This commit is contained in:
parent
6cc914b090
commit
1d3c7693b7
|
@ -1,27 +1,29 @@
|
||||||
# Configs
|
# 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="mysql"
|
||||||
typeset -u MYSQL_ALIAS
|
DB_PASSWORD="YOUR_DB_PASSWORD"
|
||||||
MYSQL_ALIAS="YOUR_MYSQL_ALIAS"
|
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/Dockerfile
|
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
|
||||||
|
|
||||||
|
# Build the database image
|
||||||
# Build the MySQL image
|
cd images/$DB_TYPE
|
||||||
cd images/mysql
|
docker build -t gogs/$DB_TYPE .
|
||||||
docker build -i gogs/mysql .
|
#
|
||||||
|
## Build the gogits image
|
||||||
# Build the gogits image
|
cd ../gogits
|
||||||
cd images/gogits
|
docker build -t gogs/gogits .
|
||||||
docker build -i gogs/gogits .
|
#
|
||||||
|
## Run MySQL image with name
|
||||||
# Run MySQL image with name
|
docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE
|
||||||
docker run -d --name $MYSQL_RUN_NAME gogs/mysql
|
#
|
||||||
|
## Run gogits image and link it to the database image
|
||||||
# Run gogits image and link it to the MySQL image
|
echo "Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:"
|
||||||
docker run --link $MYSQL_RUN_NAME:$MYSQL_ALIAS -p $HOST_PORT:3000 gogs/gogits
|
echo -e "\033[33m docker run -i -t --link $DB_RUN_NAME:db -p $HOST_PORT:3000 gogs/gogits \033[0m"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue