forked from gitea/gitea
1
0
Fork 0

Add the apt source when installing potgres.

Replace the host with $DB_PORT, which is dependent to the database imagae's exposed port.
This commit is contained in:
Lance Ju 2014-04-16 00:55:39 +08:00
parent 1f989d0b98
commit f456f964ec
1 changed files with 5 additions and 1 deletions

View File

@ -14,6 +14,8 @@ if [ $DB_TYPE = "postgres" ]
then then
# Add the postgres in gogs image. # Add the postgres in gogs image.
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 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 python-software-properties software-properties-common
apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
fi fi
@ -24,7 +26,9 @@ fi
# DB_PORT_3306_TCP_PORT=3306 # DB_PORT_3306_TCP_PORT=3306
# DB_PORT_3306_TCP_PROTO=tcp # DB_PORT_3306_TCP_PROTO=tcp
# DB_PORT_3306_TCP_ADDR=172.17.0.2 # 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/ 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") # The sudo is a must here, or the go within docker container won't get the current user by os.Getenv("USERNAME")