aboutsummaryrefslogtreecommitdiff
path: root/tcwg-base/build-image.sh
blob: 14751841007d4a3da169f8c8d4e6886ba3537ff3 (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
#!/bin/sh

set -e

trap cleanup_exit INT TERM EXIT

cleanup_exit()
{
  rm -rf tcwg-buildslave
}

export LANG=C
top=$(git rev-parse --show-toplevel)
distro=$(basename ${PWD} | cut -f1 -d '-')
arch=$(basename ${PWD} | cut -f2 -d '-')
name=$(basename ${PWD} | cut -f3- -d '-')
image=linaro/ci-${arch}-${name}-ubuntu:${distro}
baseimage=$(grep "^FROM" Dockerfile | head -n 1 | cut -d" " -f 2)

"$top"/tcwg-base/validate-dockerfile.sh Dockerfile
docker pull $baseimage 2>/dev/null || true
docker pull $image 2>/dev/null || true
docker build --tag=$image .
echo $image > .docker-tag