diff --git a/.circleci/config.yml b/.circleci/config.yml index 0d7e759..e2603a4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ jobs: - run: shell: /bin/bash command: | - docker build -f Dockerfile-community-edition -t ictu/sonar:${CIRCLE_TAG} . + docker build -t ictu/sonar:${CIRCLE_TAG} . docker login -u $DOCKER_USER -p $DOCKER_PASS docker push ictu/sonar:${CIRCLE_TAG} build_and_push_de_tag: @@ -18,7 +18,7 @@ jobs: - run: shell: /bin/bash command: | - docker build -f Dockerfile-developer-edition -t ictu/sonar:${CIRCLE_TAG} . + docker build --build-arg="IMAGE_EDITION=developer" -t ictu/sonar:${CIRCLE_TAG} . docker login -u $DOCKER_USER -p $DOCKER_PASS docker push ictu/sonar:${CIRCLE_TAG} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..754ce97 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,35 @@ +name: Docker Image CI + +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - env: + IMAGE_EDITION: community + - env: + IMAGE_EDITION: developer + steps: + - uses: actions/checkout@v3 + + - name: Build the Docker image + run: docker build --build-arg="IMAGE_EDITION=${{ env.IMAGE_EDITION }}" -t ci . + + - name: Run the Docker image + run: docker run -d --name ci ci + + - name: Verify the Docker image + # profile for language 'web' is the last; assume everything is working if we got this far + run: docker logs -f ci |& sed '/Current profile for language web is Sonar way/ q' + timeout-minutes: 3 + + - name: Stop the Docker image + run: docker stop ci diff --git a/Dockerfile-community-edition b/Dockerfile similarity index 82% rename from Dockerfile-community-edition rename to Dockerfile index 18b1925..df2b8d8 100644 --- a/Dockerfile-community-edition +++ b/Dockerfile @@ -1,4 +1,7 @@ -FROM sonarqube:10.1.0-community +ARG IMAGE_NAME=sonarqube +ARG IMAGE_VERSION=10.1.0 +ARG IMAGE_EDITION=community +FROM $IMAGE_NAME:$IMAGE_VERSION-$IMAGE_EDITION USER root RUN apt-get update && apt-get install -y wget curl ca-certificates-java jq postgresql-client \ && rm -rf /var/lib/apt/lists/* diff --git a/Dockerfile-developer-edition b/Dockerfile-developer-edition deleted file mode 100644 index c67c299..0000000 --- a/Dockerfile-developer-edition +++ /dev/null @@ -1,17 +0,0 @@ -FROM sonarqube:10.1.0-developer -USER root -RUN apt-get update && apt-get install -y wget curl ca-certificates-java jq postgresql-client \ - && rm -rf /var/lib/apt/lists/* -ADD ./plugins /tmp/plugins -RUN rm -rf ./extensions/plugins/* && \ - cat /tmp/plugins/plugin-list && \ - chmod +x /tmp/plugins/install-plugins.sh && \ - ls /tmp/plugins -l && \ - /tmp/plugins/install-plugins.sh -WORKDIR /opt/sonarqube -COPY ./start-with-profile.sh . -ADD ./rules /tmp/rules -ADD sonar.properties /opt/sonarqube/conf/sonar.properties -RUN chown -R sonarqube:sonarqube . && chmod +x start-with-profile.sh -USER sonarqube -CMD ["./start-with-profile.sh"]