diff --git a/.github/workflows/static_code_analysis.yml b/.github/workflows/static_code_analysis.yml index 92bb6348b..9fc37eab4 100644 --- a/.github/workflows/static_code_analysis.yml +++ b/.github/workflows/static_code_analysis.yml @@ -26,6 +26,7 @@ jobs: run: | sudo apt update sudo apt install -y libpcap-dev + ./devops/install-capstone.sh - name: Check Agent modified files id: agent_modified_files diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7abf91fa2..b8d6bd0bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,6 +35,11 @@ jobs: run: | sudo apt-get install libpcap-dev + - name: Install Capstone + shell: bash + run: | + ./devops/install-capstone.sh + - name: Check CLI modified files id: cli_modified_files run: devops/check_modified_files.sh cli/ diff --git a/Dockerfile b/Dockerfile index 50ad7e7c3..4141655aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,9 @@ RUN npm run build ### Base builder image for native builds architecture FROM golang:1.17-alpine AS builder-native-base ENV CGO_ENABLED=1 GOOS=linux -RUN apk add --no-cache libpcap-dev g++ perl-utils +RUN apk add --no-cache libpcap-dev g++ perl-utils git build-base bash +COPY devops/install-capstone.sh . +RUN ./install-capstone.sh ### Intermediate builder image for x86-64 to x86-64 native builds diff --git a/devops/install-capstone.sh b/devops/install-capstone.sh index 64d1c5056..847da1cee 100755 --- a/devops/install-capstone.sh +++ b/devops/install-capstone.sh @@ -1,6 +1,11 @@ #!/bin/bash -git clone https://github.com/capstone-engine/capstone.git -b 4.0.2 && \ -git checkout capstone && \ +SUDO='' +if (( $EUID != 0 )); then + SUDO='sudo' +fi + +git clone https://github.com/capstone-engine/capstone.git -b 4.0.2 --depth 1 && \ +cd capstone && \ ./make.sh && \ -sudo ./make.sh install +$SUDO ./make.sh install