You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dockerfiles/build.sh
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,12 @@ HOST_PORT="YOUR_HOST_PORT" # The port on host, which will be redirected t
10
10
# apt source, you can select 'nchc'(mirror in Taiwan) or 'aliyun'(best for mainlance China users) according to your network, if you could connect to the official unbunt mirror in a fast speed, just leave it to "".
11
11
APT_SOURCE=""
12
12
13
+
DOCKER_BIN=$(which docker.io || which docker)
14
+
if [ -z"$DOCKER_BIN" ] ;then
15
+
echo"Please install docker. You can install docker by running \"wget -qO- https://get.docker.io/ | sh\"."
16
+
exit 1
17
+
fi
18
+
13
19
# Replace the database root password in database image Dockerfile.
14
20
sed -i "s/THE_DB_PASSWORD/$DB_PASSWORD/g" images/$DB_TYPE/Dockerfile
15
21
# Replace the database root password in gogits image deploy.sh file.
@@ -36,22 +42,22 @@ if [ $MEM_TYPE != "" ]
36
42
sed -i "${GOGS_BUILD_LINE}s/$/ -tags $MEM_TYPE/" images/gogits/Dockerfile
37
43
38
44
cd images/$MEM_TYPE
39
-
docker build -t gogits/$MEM_TYPE.
40
-
docker run -d --name $MEM_RUN_NAME gogits/$MEM_TYPE
45
+
$DOCKER_BIN build -t gogits/$MEM_TYPE.
46
+
$DOCKER_BIN run -d --name $MEM_RUN_NAME gogits/$MEM_TYPE
41
47
MEM_LINK=" --link $MEM_RUN_NAME:mem "
42
48
cd ../../
43
49
fi
44
50
45
51
# Build the database image
46
52
cd images/$DB_TYPE
47
-
docker build -t gogits/$DB_TYPE.
53
+
$DOCKER_BIN build -t gogits/$DB_TYPE.
48
54
#
49
55
50
56
51
57
## Build the gogits image
52
58
cd ../gogits
53
59
54
-
docker build -t gogits/gogs .
60
+
$DOCKER_BIN build -t gogits/gogs .
55
61
56
62
#sed -i "s#RUN go get -u -tags $MEM_TYPE github.com/gogits/gogs#RUN go get -u github.com/gogits/gogs#g" Dockerfile
57
63
@@ -60,9 +66,9 @@ sed -i "s/ -tags $MEM_TYPE//" Dockerfile
60
66
61
67
#
62
68
## Run MySQL image with name
63
-
docker run -d --name $DB_RUN_NAME gogits/$DB_TYPE
69
+
$DOCKER_BIN run -d --name $DB_RUN_NAME gogits/$DB_TYPE
64
70
#
65
71
## Run gogits image and link it to the database image
66
72
echo"Now we have the $DB_TYPE image(running) and gogs image, use the follow command to start gogs service:"
0 commit comments