-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.sh
More file actions
executable file
·120 lines (91 loc) · 1.92 KB
/
make.sh
File metadata and controls
executable file
·120 lines (91 loc) · 1.92 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env bash
# Setup
set -uexo pipefail
which greadlink >/dev/null 2>/dev/null && readlink=greadlink || readlink=readlink
rundir=$($readlink -f "${0%/*}")
cd "$rundir"
# Default params to `build-proxy`
[ -z ${1:-} ] && set -- build-proxy "$@"
# Properties
SCOPE="deployable"
NAME="debian-build"
SCOPE_NAME="${SCOPE}/${NAME}"
#IMAGE=$(awk 'tolower($1) ~ /^from$/ {print $2}' Dockerfile)
IMAGE=debian
LOCALE="original"
PROXY="http://10.8.8.8:3142"
if [ -z "${BUILD_ARGS:-}" ]; then
BUILD_ARGS=""
fi
# Commands
pull(){
docker pull "${IMAGE}"
}
build(){
build_one latest
}
build_one(){
local tag=$1
rm -f Dockerfile.$tag
perl -pe 's/debian:latest/debian:'$tag'/' Dockerfile > Dockerfile.$tag
docker build --build-arg DOCKER_BUILD_PROXY="${PROXY}" -t ${SCOPE_NAME}:$tag ${BUILD_ARGS} -f Dockerfile.$tag .
}
build_all(){
build_one wheezy
build_one 7
build_one jessie
build_one 8
build_one stretch
build_one 9
build_one latest
build_one testing
}
locale(){
BUILD_ARGS="${BUILD_ARGS} --build-arg DOCKER_BUILD_LOCALE=${LOCALE}"
echo "set BUILD_ARGS: ${BUILD_ARGS}"
}
au(){
LOCALE=au
echo "set LOCALE: ${LOCALE}"
}
proxy(){
BUILD_ARGS="${BUILD_ARGS} --build-arg DOCKER_BUILD_PROXY=${PROXY}"
echo "set BUILD_ARGS: ${BUILD_ARGS}"
}
git_tag(){
local build_tag=${1:-$(date +%Y%m%d)}
git tag -f "${build_tag}" && git push -f --tags
}
clean(){
docker rmi ${SCOPE_NAME}
}
# Orchestration
pull-build(){
pull
build
}
build-au(){
au
locale
pull-build
}
build-proxy(){
proxy
pull-build
}
build-au-proxy(){
au
locale
proxy
pull-build
}
label_vcsref(){
git_revision=$(git rev-parse --verify HEAD)
perl -i -pane 's!org\.label-schema\.vcs-ref.*!org.label-schema.vcs-ref = "'$git_revision'" \\!g;' Dockerfile
}
label_version(){
local version=$(date +%Y%m%d)
perl -i -pane 's!org\.label-schema\.version.*!org.label-schema.version = "'$version'" \\!g;' Dockerfile
}
# Runit
"$@"