-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·49 lines (39 loc) · 1.84 KB
/
build.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
48
49
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(dirname "$0")"
cd "$SCRIPT_DIR"
image_name="${DOCKER_IMAGE:-dciancu/kismet-wireless-docker}"
image_arch="${BUILD_ARCH:-$(arch | tr -d '\n')}"
if [[ -n "${CIRCLE_BRANCH+x}" ]] && [[ "$CIRCLE_BRANCH" == 'test' ]]; then
image_stable_tag="${image_name}:test-stable-${image_arch}"
build_stable_tag="${image_name}:test-build-stable-${image_arch}"
image_edge_tag="${image_name}:test-edge-${image_arch}"
build_edge_tag="${image_name}:test-build-edge-${image_arch}"
else
if [[ -n "${CIRCLE_BRANCH+x}" ]] && [[ "$CIRCLE_BRANCH" == 'build' ]]; then
docker images | grep "$image_name" | tr -s ' ' | cut -d ' ' -f 2 \
| xargs -I {} docker rmi -f "${image_name}:{}" || true
docker buildx prune -f
fi
image_stable_tag="${image_name}:stable-${image_arch}"
build_stable_tag="${image_name}:build-stable-${image_arch}"
image_edge_tag="${image_name}:edge-${image_arch}"
build_edge_tag="${image_name}:build-edge-${image_arch}"
fi
if [ ! -f configure_override.txt ]; then
touch configure_override.txt
fi
docker build --target build -t "$build_stable_tag" --pull \
--build-arg KISMET_STABLE=1 --build-arg "KISMET_REPO_URL=${KISMET_REPO_URL:-}" .
docker build --target build -t "$build_edge_tag" --build-arg "KISMET_REPO_URL=${KISMET_REPO_URL:-}" .
docker build -t "$image_stable_tag" --build-arg KISMET_STABLE=1 --build-arg "KISMET_REPO_URL=${KISMET_REPO_URL:-}" .
docker build -t "$image_edge_tag" --build-arg "KISMET_REPO_URL=${KISMET_REPO_URL:-}" .
if [[ -n "${CIRCLE_BRANCH+x}" ]]; then
echo "$DOCKER_PASS" | docker login -u "$DOCKER_USERNAME" --password-stdin
docker push "$image_stable_tag"
docker push "$image_edge_tag"
if [[ "$CIRCLE_BRANCH" == 'test' ]]; then
docker push "$build_stable_tag"
docker push "$build_edge_tag"
fi
fi