Sonarcloud Django, AWS

I’m trying to run the buildspec.yml file with the below configuration
Objective trying to run the buildspec file for the django project which will have codebuild with the Buildspec.yaml file,
i’m trying to

version: 0.2

phases:
  install:
    runtime-versions:
      python: 3.11
    commands:
    - echo "Checking default Java version..."
    - java -version
    - echo "Installing dependencies..."
    - pip install pylint
    - echo "Downloading and setting up SonarScanner CLI..."
    - wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-5.0.1.3006-linux.zip
    - unzip sonar-scanner-cli-5.0.1.3006-linux.zip -d /opt
    - rm sonar-scanner-cli-5.0.1.3006-linux.zip
    - export PATH=$PATH:/opt/sonar-scanner-5.0.1.3006-linux/bin
    - export SONAR_SCANNER_HOME=/opt/sonar-scanner-5.0.1.3006-linux
    - echo "Creating sonar user and group..."
    - groupadd sonar || true
    - useradd -r -s /bin/false -g sonar sonar || true
    - chown -R sonar:sonar /opt/sonar-scanner-5.0.1.3006-linux
    - chmod -R 755 /opt/sonar-scanner-5.0.1.3006-linux
    - unset JAVA_HOME
    - export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
    - echo "JAVA_HOME is set to $JAVA_HOME"
    - echo "Checking Java version and verifying file path..."
    - java -version
    - which java
    - ls -l $(which java)

  pre_build:
    commands:
    - echo "Pre-build step; install project dependencies..."
    - pip install -r requirements.txt

  build:
    commands:
    - echo "Running pylint..."
    - pylint --exit-zero accounts/ main/ southern_delicious/
    - echo "Switching to sonar user and running sonar-scanner..."
    - sudo -E -u sonar /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -v
    - sudo -E -u sonar /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -X

  post_build:
    commands:
    - echo "Post-build steps..."

below is the error logs

[Container] 2024/03/31 11:00:07.317259 Running command echo "Switching to sonar user and running sonar-scanner..."
1737 Switching to sonar user and running sonar-scanner...
1738
1739 [Container] 2024/03/31 11:00:07.327067 Running command sudo -E -u sonar /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -v
1740 /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner: line 66: /opt/sonar-scanner-5.0.1.3006-linux/jre/bin/java: cannot execute binary file: Exec format error
1741 /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner: line 66: /opt/sonar-scanner-5.0.1.3006-linux/jre/bin/java: Success
1742
1743 [Container] 2024/03/31 11:00:09.409040 Command did not exit successfully sudo -E -u sonar /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -v exit status 126
1744 [Container] 2024/03/31 11:00:09.414925 Phase complete: BUILD State: FAILED
1745 [Container] 2024/03/31 11:00:09.414943 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: sudo -E -u sonar /opt/sonar-scanner-5.0.1.3006-linux/bin/sonar-scanner -v. Reason: exit status 126
1746 [Container] 2024/03/31 11:00:09.449905 Entering phase POST_BUILD
1747 [Container] 2024/03/31 11:00:09.450612 Running command echo "Post-build steps..."
1748 Post-build steps...

Hi,

Welcome to the community!

A quick search on the error message

took me to an indication that this is about architecture.

 
HTH,
Ann