Skip to content

Instantly share code, notes, and snippets.

@avoidik
Last active January 9, 2025 17:52
Show Gist options
  • Save avoidik/8041e515a0de04fa3b539a0cbdb59239 to your computer and use it in GitHub Desktop.
Save avoidik/8041e515a0de04fa3b539a0cbdb59239 to your computer and use it in GitHub Desktop.

Revisions

  1. avoidik revised this gist Sep 20, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -41,6 +41,7 @@ func main() {
    fmt.Println("Hello World!")
    }
    EOF
    $ go fmt main.go
    $ go run main.go
    ```

  2. avoidik revised this gist Sep 20, 2024. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,7 @@ $ docker run --rm -i -t --name go-lang-test \
    --platform linux/aarch64 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v $(pwd):/build \
    -w /build \
    --network sonarqube \
    public.ecr.aws/codebuild/amazonlinux2-aarch64-standard:3.0 bash
    ```
  3. avoidik revised this gist Sep 20, 2024. 1 changed file with 52 additions and 0 deletions.
    52 changes: 52 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,61 @@
    Run SonarQube

    ```terminal
    $ git clone https://github.com/SonarSource/docker-sonarqube
    $ cd docker-sonarqube
    $ docker build -t sonarqube:9.9.4.87374 --build-arg SONARQUBE_VERSION=9.9.4.87374 -f 9/community/Dockerfile 9/community/
    $ docker network create sonarqube
    $ docker run --rm -i -t --name sonarqube -p 9000:9000 \
    --security-opt seccomp=unconfined --security-opt apparmor=unconfined \
    -e SONAR_SEARCH_JAVAADDITIONALOPTS='-Dbootstrap.system_call_filter=false' \
    --network sonarqube \
    sonarqube:9.9.4.87374
    ```

    Visit http://localhost:9000, change default password, create project and token.

    Prepare project environment

    ```terminal
    $ mkdir go-lang-test
    $ cd go-lang-test
    $ docker run --rm -i -t --name go-lang-test \
    --platform linux/aarch64 \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -v $(pwd):/build \
    --network sonarqube \
    public.ecr.aws/codebuild/amazonlinux2-aarch64-standard:3.0 bash
    ```

    Prepare sample project

    ```
    $ go mod init hello
    $ cat <<'EOF' | tee main.go
    package main
    import "fmt"
    func main() {
    fmt.Println("Hello World!")
    }
    EOF
    $ go run main.go
    ```

    Run Sonarqube Scanner

    ```terminal
    $ curl -fsSLO https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-6.1.0.4477-linux-aarch64.zip
    $ unzip sonar-scanner-cli-6.1.0.4477-linux-aarch64.zip
    $ export PATH="$PATH:$(pwd)/sonar-scanner-6.1.0.4477-linux-aarch64/bin"
    $ SONAR_TOKEN='sqp_f575f529d44c4998a816ea82e5c9615275b3ba59'
    $ SONAR_URL='http://sonarqube:9000'
    $ sonar-scanner \
    -Dsonar.projectBaseDir="$(pwd)" \
    -Dsonar.projectKey='go-lang-test' \
    -Dsonar.sources='.' \
    -Dsonar.host.url="$SONAR_URL" \
    -Dsonar.login="$SONAR_TOKEN" \
    -Dsonar.verbose=true -X
    ```
  4. avoidik revised this gist Sep 20, 2024. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -2,5 +2,8 @@
    $ git clone https://github.com/SonarSource/docker-sonarqube
    $ cd docker-sonarqube
    $ docker build -t sonarqube:9.9.4.87374 --build-arg SONARQUBE_VERSION=9.9.4.87374 -f 9/community/Dockerfile 9/community/
    $ docker run --rm -i -t --name sonarqube -p 9000:9000 --security-opt seccomp=unconfined --security-opt apparmor=unconfined sonarqube:9.9.4.87374
    $ docker run --rm -i -t --name sonarqube -p 9000:9000 \
    --security-opt seccomp=unconfined --security-opt apparmor=unconfined \
    -e SONAR_SEARCH_JAVAADDITIONALOPTS='-Dbootstrap.system_call_filter=false' \
    sonarqube:9.9.4.87374
    ```
  5. avoidik renamed this gist Sep 20, 2024. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. avoidik created this gist Sep 20, 2024.
    6 changes: 6 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    ```terminal
    $ git clone https://github.com/SonarSource/docker-sonarqube
    $ cd docker-sonarqube
    $ docker build -t sonarqube:9.9.4.87374 --build-arg SONARQUBE_VERSION=9.9.4.87374 -f 9/community/Dockerfile 9/community/
    $ docker run --rm -i -t --name sonarqube -p 9000:9000 --security-opt seccomp=unconfined --security-opt apparmor=unconfined sonarqube:9.9.4.87374
    ```