forked from ossobv/bcg729-deb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Docker.build
executable file
·25 lines (21 loc) · 938 Bytes
/
Docker.build
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
#!/bin/sh
cd "$(dirname "$0")" # jump to curdir
# Take version from changelog; docker takes fewer legal chars.
buildversion=$(sed -e '1!d;s/.*(//;s/).*//' changelog)
upversion=$(echo "$buildversion" | sed -e 's/-.*//;s/^[0-9]*://')
debepoch=$(echo "$buildversion" | sed -e '/^[0-9]*:/!d;s/:.*/:/')
debversion=$(echo "$buildversion" | sed -e 's/[^-]*-//;s/+[^+]*$//')
dockname=$(basename $(pwd))
dockversion=$(echo "$buildversion" | sed -e 's/^[0-9]*://;s/[^A-Za-z0-9.-]/_/g')
# Build for stretch.
codename=stretch # don't change unless you fix "FROM debian:stretch"
# Build.
docker build \
--build-arg upversion=$upversion \
--build-arg debepoch=$debepoch \
--build-arg debversion=$debversion \
-t $dockname:$dockversion -f Dockerfile . || exit 1
# Run, so we export the compiled packages.
docker run -e UID=$(id -u) \
-v "$(pwd)/Docker.out/$codename:/Docker.out/$codename" \
$dockname:$dockversion || exit 1