1 #!/bin/echo "source me !"
3 # $1: image directory; $2: image tag; $3: Dockerfile parent dir ('.' by default); $4: build context ('.' by default); $5: extra arguments (quoted)
11 local imgname=$(basename ${imgdir})
13 echo "Building ${imgname}:${imgtag} ..."
16 # Dockerfile for other contexts:
17 local dck_opt="-f ${dckdir}/Dockerfile"
18 local preferred=${dckdir}/Dockerfile.$(arch)
19 [ -f ${preferred} ] && { dck_opt="-f ${preferred}" ; echo "Selected '${preferred}' for current architecture." ; }
21 docker build -t ${imgname}:${imgtag} ${xtra} ${dck_opt} ${ctxdir}
22 [ $? -ne 0 ] && { echo "An error ocurred. Aborting ..." ; cd - >/dev/null ; return 1 ; }