-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
80 lines (72 loc) · 1.94 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
#
# Makefile for all images to make sure they are
# created with the correct GID and NAME for docker.
#
# This is not ideal, as images often times are not built
# on the host they run, but at least this gives the option
# to supply them while building the images.
#
# Example usage
# $ sh build docker localhost:5000 http://proxy.example.org
#
clear
DNAME=${1-"sucker"}
DGID=$(getent group ${1-"docker"} | cut -d: -f3)
REPOSITORY=${2-"localhost:1000"}
echo "Starting build of all docker images with docker group ${1-"docker"} and id $DGID"
# Check if the optional proxy server is supplied as an argument.
if [ $# -eq 3 ]
then
echo "Using optional proxy server at ${3}"
PROXY="--build-arg HTTP_PROXY=${3}"
PROXYS="--build-arg HTTPS_PROXY=${3}"
PROXYSS="--build-arg http_proxy=${3}"
PROXYSSS="--build-arg https_proxy=${3}"
fi
echo "Building jenkins image"
docker build -t $REPOSITORY/jenkins \
${PROXY} \
${PROXYS} \
${PROXYSS} \
${PROXYSSS} \
--build-arg DOCKERGID=$DGID \
--build-arg DOCKERGNAME=$DNAME \
-f=jenkins/Dockerfile .
docker push $REPOSITORY/jenkins
echo "Building slave image"
docker build -t $REPOSITORY/jenkins-slave \
${PROXY} \
${PROXYS} \
${PROXYSS} \
${PROXYSSS} \
--build-arg DOCKERGID=$DGID \
--build-arg DOCKERGNAME=$DNAME \
-f=slave/Dockerfile .
docker push $REPOSITORY/jenkins-slave
echo "Building gradle image"
docker build -t $REPOSITORY/gradle-builder \
${PROXY} \
${PROXYS} \
${PROXYSS} \
${PROXYSSS} \
-f=gradle-builder/Dockerfile .
docker push $REPOSITORY/gradle-builder
echo "Building node image"
docker build -t $REPOSITORY/node-builder \
${PROXY} \
${PROXYS} \
${PROXYSS} \
${PROXYSSS} \
--build-arg DOCKERGID=$DGID \
--build-arg DOCKERGNAME=$DNAME \
-f=node-builder/Dockerfile .
docker push $REPOSITORY/node-builder
echo "Building compose image"
docker build -t $REPOSITORY/docker-compose \
${PROXY} \
${PROXYS} \
${PROXYSS} \
${PROXYSSS} \
-f=docker-compose/Dockerfile .
docker push $REPOSITORY/docker-compose