aboutsummaryrefslogtreecommitdiff
path: root/ci-dockerfiles-deployment/build-image.sh
blob: ecf0a114eb5c7105a2e0017af403a0fdb1d272e9 (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
#!/bin/bash

set -ex

trap cleanup_exit INT TERM EXIT

cleanup_exit()
{
    rm -rf ${HOME}/.docker dockerfiles
}

mkdir -p ${HOME}/.docker
sed -e "s|\${DOCKER_AUTH}|${DOCKER_AUTH}|" < ${WORKSPACE}/config.json > ${HOME}/.docker/config.json
chmod 0600 ${HOME}/.docker/config.json

rm -rf dockerfiles/
git clone --depth 1 https://git.linaro.org/ci/dockerfiles.git

cd dockerfiles/${image}/
if ! ./build.sh; then
    echo "=== FAIL: ${image} ==="
    exit 1
fi

# now we have image name in .docker-tag
if [ -r .docker-tag ]; then
    docker_tag=$(cat .docker-tag)
    docker push ${docker_tag}
fi