Skip to content

Commit

Permalink
Add github action and consolidate Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
wkoot committed Sep 5, 2023
1 parent 64b3432 commit 78a4aa0
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion Dockerfile-community-edition → Dockerfile
Original file line number Diff line number Diff line change
@@ -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/*
Expand Down
17 changes: 0 additions & 17 deletions Dockerfile-developer-edition

This file was deleted.

0 comments on commit 78a4aa0

Please sign in to comment.