-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-build.sh
More file actions
executable file
·92 lines (77 loc) · 1.7 KB
/
docker-build.sh
File metadata and controls
executable file
·92 lines (77 loc) · 1.7 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
# docker-build.sh - Helper script for building with Docker
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
log() {
echo -e "${GREEN}[$(date '+%Y-%m-%d %H:%M:%S')]${NC} $*"
}
error() {
echo -e "${RED}[ERROR]${NC} $*" >&2
}
warn() {
echo -e "${YELLOW}[WARNING]${NC} $*"
}
usage() {
cat << EOF
Usage: $0 [command] [options]
Commands:
build-image Build the Docker image
shell Start an interactive shell in the container
build Build tools (pass arguments to build.sh)
clean Clean build artifacts
help Show this help message
Examples:
$0 build-image
$0 shell
$0 build --arch arm glib2
$0 build --arch arm64 --all
$0 clean
EOF
}
build_image() {
log "Building Docker image..."
docker-compose build
log "Docker image built successfully"
}
start_shell() {
log "Starting interactive shell..."
docker-compose run --rm nethunter-build /bin/bash
}
run_build() {
log "Running build command: ./build.sh $*"
docker-compose run --rm nethunter-build ./build.sh "$@"
}
clean_artifacts() {
log "Cleaning build artifacts..."
docker-compose run --rm nethunter-build ./build.sh clean
log "Build artifacts cleaned"
}
# Main script
case "${1:-help}" in
build-image)
build_image
;;
shell)
start_shell
;;
build)
shift
run_build "$@"
;;
clean)
clean_artifacts
;;
help|--help|-h)
usage
;;
*)
error "Unknown command: $1"
usage
exit 1
;;
esac