1+ echo " Enter version of file monitor to use with docker (e.g. 1.0.0):"
2+
3+ if [ -z " $1 " ]; then
4+ read -r version
5+ else
6+ version=" $1 "
7+ fi
8+
9+ echo " Building Docker image with version: $version "
10+
11+ if ! command -v gh & > /dev/null; then
12+ echo " gh CLI is not installed. Please install it first and proceed with authentication."
13+ exit 1
14+ fi
15+
16+ if ! gh auth status & > /dev/null; then
17+ echo " You are not authenticated with GitHub CLI. Please authenticate first."
18+ exit 1
19+ fi
20+
21+ gh release download v${version} --repo SentinalFS/file-monitor --clobber --pattern " monitor.bpf.o"
22+
23+ if [ $? -ne 0 ]; then
24+ echo " Failed to download the file monitor binary. Please check the version and try again."
25+ exit 1
26+ fi
27+
28+ echo " Running go releaser"
29+
30+ if ! command -v go & > /dev/null; then
31+ echo " Go is not installed. Please install Go and try again."
32+ exit 1
33+ fi
34+
35+ if ! command -v goreleaser & > /dev/null; then
36+ echo " Goreleaser is not installed. Please install Goreleaser and try again."
37+ exit 1
38+ fi
39+
40+ goreleaser release --snapshot --skip=publish --clean
41+
42+
43+ if docker --version & > /dev/null; then
44+ echo " Docker is installed. Proceeding with build."
45+ else
46+ echo " Docker is not installed. Please install Docker and try again."
47+ exit 1
48+ fi
49+
50+ arch=$( uname -m)
51+ if [ " $arch " = " aarch64" ] || [ " $arch " = " arm64" ]; then
52+ echo " Detected ARM architecture. Building Docker image for ARM."
53+ docker build -t go-logger-arm:latest -f Dockerfile.amd64 --build-arg TARGETARCH=arm64 .
54+ if [ $? -ne 0 ]; then
55+ echo " Docker build for ARM failed."
56+ exit 1
57+ fi
58+ elif [ " $arch " = " x86_64" ]; then
59+ echo " Detected x86_64 architecture. Building Docker image for x86_64."
60+ docker build -t go-logger-amd64:latest -f Dockerfile.amd64 --build-arg TARGETARCH=amd64 .
61+ if [ $? -ne 0 ]; then
62+ echo " Docker build for x86_64 failed."
63+ exit 1
64+ fi
65+ else
66+ echo " Non-ARM architecture detected. No additional ARM build required."
67+ fi
0 commit comments