aboutsummaryrefslogtreecommitdiff
path: root/dockerfiles/build.sh
diff options
context:
space:
mode:
authorcrystaldust <juzhenatpku@gmail.com>2014-04-10 19:56:19 +0800
committercrystaldust <juzhenatpku@gmail.com>2014-04-10 19:56:19 +0800
commit5966dd78e67de613bea53a517712645c8449b358 (patch)
tree05effe7d7c49714790485a19c917924e6b7ea7d7 /dockerfiles/build.sh
parent4efb56af03bf8a113e9b39d123b9399e546d3505 (diff)
Add the scirpts for auto deploy.
Diffstat (limited to 'dockerfiles/build.sh')
-rwxr-xr-xdockerfiles/build.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/dockerfiles/build.sh b/dockerfiles/build.sh
new file mode 100755
index 00000000..113f63db
--- /dev/null
+++ b/dockerfiles/build.sh
@@ -0,0 +1,28 @@
+# Configs
+MYSQL_PASSWORD="kuajie8402"
+MYSQL_RUN_NAME="gogs_mysql"
+typeset -u MYSQL_ALIAS
+MYSQL_ALIAS="db"
+HOST_PORT="3000"
+
+# 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
+sed -i "s/THE_MYSQL_ALIAS/$MYSQL_ALIAS/g" images/gogits/deploy.sh
+
+
+# Build the MySQL image
+cd images/mysql
+docker build -t gogs/mysql .
+#
+## Build the gogits image
+cd images/gogits
+docker build -t gogs/gogits .
+#
+## Run MySQL image with name
+docker run -d --name $MYSQL_RUN_NAME gogs/mysql
+#
+## Run gogits image and link it to the MySQL image
+docker run --link $MYSQL_RUN_NAME:$MYSQL_ALIAS -p $HOST_PORT:3000 gogs/gogits
+