From f456f964ecdd5e01b3a54df09493a2e6adc35c09 Mon Sep 17 00:00:00 2001 From: Lance Ju Date: Wed, 16 Apr 2014 00:55:39 +0800 Subject: [PATCH] Add the apt source when installing potgres. Replace the host with $DB_PORT, which is dependent to the database imagae's exposed port. --- dockerfiles/images/gogits/deploy.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dockerfiles/images/gogits/deploy.sh b/dockerfiles/images/gogits/deploy.sh index 8c0e246b1..47e13260c 100644 --- a/dockerfiles/images/gogits/deploy.sh +++ b/dockerfiles/images/gogits/deploy.sh @@ -14,6 +14,8 @@ if [ $DB_TYPE = "postgres" ] then # Add the postgres in gogs image. apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 + echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list + apt-get update apt-get -y -q install python-software-properties software-properties-common apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 fi @@ -24,7 +26,9 @@ fi # DB_PORT_3306_TCP_PORT=3306 # DB_PORT_3306_TCP_PROTO=tcp # DB_PORT_3306_TCP_ADDR=172.17.0.2 -sed -i "/HOST = 127.0.0.1:3306/c\HOST = $DB_PORT_3306_TCP_ADDR:$DB_PORT_3306_TCP_PORT" $GOPATH/src/github.com/gogits/gogs/conf/app.ini +#sed -i "/HOST = 127.0.0.1:3306/c\HOST = $DB_PORT_3306_TCP_ADDR:$DB_PORT_3306_TCP_PORT" $GOPATH/src/github.com/gogits/gogs/conf/app.ini +sed -i "/HOST = 127.0.0.1:3306/c\HOST = `echo $DB_PORT | cut -d '/' -f 3`" $GOPATH/src/github.com/gogits/gogs/conf/app.ini + cd $GOPATH/src/github.com/gogits/gogs/ # The sudo is a must here, or the go within docker container won't get the current user by os.Getenv("USERNAME")