blob: d7e98cad9f4537c9e7dbdeb7b061d734202c5245 (
plain)
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
|
#!/bin/bash
set -ex
set -eo pipefail
function run_docker
{
$DOCKER_PREFIX docker run --cap-add=sys_admin --net=host --rm=true \
--user="${USER}" -w "${PWD}" -v "${PWD}":"${PWD}":Z \
-t $1 $2
}
env
if [ -d output-images ]; then
echo 'output-images already exists!';
exit 1;
fi
for distro in ubuntu1404 fedora23;
do
base_dockerfile=ci/Dockerfile/$distro.`arch`
if [ ! -f $base_dockerfile ]; then
echo '$distro not supported on `arch`.';
continue
fi
if [[ -n "$HTTP_PROXY" ]]; then
http_proxy=$HTTP_PROXY
fi
if [[ -n "$http_proxy" ]]; then
if [[ "$distro" == fedora23 ]]; then
PROXY="RUN echo \"proxy=${http_proxy}\" >> /etc/dnf/dnf.conf"
fi
if [[ "$distro" == ubuntu1404 ]]; then
PROXY="RUN echo \"Acquire::http::Proxy \\"\"${http_proxy}/\\"\";\" > /etc/apt/apt.conf.d/000apt-cacher-ng-proxy"
fi
fi
Dockerfile=$(head -n1 $base_dockerfile; echo ${PROXY}; tail -n +2 $base_dockerfile; cat << EOF
RUN groupadd -g ${GROUPS} ${USER} && useradd -d ${HOME} -m -u ${UID} -g ${GROUPS} ${USER}
${PROXY}
USER ${USER}
ENV HOME ${HOME}
EOF
)
$DOCKER_PREFIX docker build -t openpower/op-build-$distro - <<< "${Dockerfile}"
mkdir -p output-images/$distro
run_docker openpower/op-build-$distro "./ci/build-all-defconfigs.sh output-images/$distro"
if [ $? = 0 ]; then
mv *-images output-$distro/
else
exit $?;
fi
done;
|