2014-04-11 10:55:43 +04:00
|
|
|
# Configs of the docker images, you might have specify your own configs here.
|
2014-04-16 07:48:33 +04:00
|
|
|
|
2014-04-15 20:54:02 +04:00
|
|
|
# type of database, support 'mysql' and 'postgres'
|
|
|
|
DB_TYPE="postgres"
|
2014-04-16 07:48:33 +04:00
|
|
|
# apt source, you can select 'nchc' or 'aliyun' according to your network.
|
|
|
|
APT_SOURCE="nchc"
|
|
|
|
|
2014-04-15 20:54:02 +04:00
|
|
|
DB_PASSWORD="YOUR_DB_PASSWORD"
|
|
|
|
DB_RUN_NAME="YOUR_DB_RUN_NAME"
|
2014-04-11 10:55:43 +04:00
|
|
|
HOST_PORT="YOUR_HOST_PORT"
|
2014-04-10 15:56:19 +04:00
|
|
|
|
2014-04-15 20:54:02 +04:00
|
|
|
# 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
|
2014-04-16 07:48:33 +04:00
|
|
|
# Replace the apt source in gogits image Dockerfile.
|
|
|
|
sed -i "s/#$APT_SOURCE#//g" images/gogits/Dockerfile
|
2014-04-15 20:54:02 +04:00
|
|
|
# Replace the database type in gogits image deploy.sh file.
|
|
|
|
sed -i "s/THE_DB_TYPE/$DB_TYPE/g" images/gogits/deploy.sh
|
2014-04-10 15:56:19 +04:00
|
|
|
|
2014-04-15 20:54:02 +04:00
|
|
|
# Build the database image
|
|
|
|
cd images/$DB_TYPE
|
|
|
|
docker build -t gogs/$DB_TYPE .
|
2014-04-10 15:56:19 +04:00
|
|
|
#
|
|
|
|
## Build the gogits image
|
2014-04-11 11:32:57 +04:00
|
|
|
cd ../gogits
|
2014-04-10 15:56:19 +04:00
|
|
|
docker build -t gogs/gogits .
|
|
|
|
#
|
|
|
|
## Run MySQL image with name
|
2014-04-15 20:54:02 +04:00
|
|
|
docker run -d --name $DB_RUN_NAME gogs/$DB_TYPE
|
2014-04-10 15:56:19 +04:00
|
|
|
#
|
2014-04-15 20:54:02 +04:00
|
|
|
## 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"
|
2014-04-10 15:56:19 +04:00
|
|
|
|