-
Notifications
You must be signed in to change notification settings - Fork 508
/
ddist.sh
executable file
·47 lines (37 loc) · 917 Bytes
/
ddist.sh
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
#!/bin/bash
set -o errexit
set -o nounset
REL_HERE=$(dirname "${BASH_SOURCE}")
HERE=$(cd "${REL_HERE}"; pwd)
IMG="tini-build"
if [[ -n "${ARCH_SUFFIX-}" ]]; then
IMG="${IMG}_${ARCH_SUFFIX}"
fi
if [[ -n "${ARCH_NATIVE-}" ]]; then
IMG="${IMG}_native"
fi
if [[ -n "${CC-}" ]]; then
IMG="${IMG}_${CC}"
fi
# Cleanup the build dir
rm -f "${HERE}/dist"/*
# Create the build image
echo "build: ${IMG}"
docker build \
--build-arg "ARCH_SUFFIX=${ARCH_SUFFIX-}" \
--build-arg "ARCH_NATIVE=${ARCH_NATIVE-}" \
--build-arg "CC=${CC-gcc}" \
-t "${IMG}" \
.
# Build new Tini
SRC="/tini"
docker run -it --rm \
--volume="${HERE}:${SRC}" \
-e BUILD_DIR=/tmp/tini-build \
-e SOURCE_DIR="${SRC}" \
-e FORCE_SUBREAPER="${FORCE_SUBREAPER-1}" \
-e GPG_PASSPHRASE="${GPG_PASSPHRASE-}" \
-e CFLAGS="${CFLAGS-}" \
-e MINIMAL="${MINIMAL-}" \
-u "$(id -u):$(id -g)" \
"${IMG}" "${SRC}/ci/run_build.sh"