From 1645806299d95d8cc1c2e1ab557537bb156d1754 Mon Sep 17 00:00:00 2001 From: Laszlo Bende Date: Mon, 7 Oct 2024 20:31:08 +0100 Subject: [PATCH] BuildPublishDocker workflow file Signed-off-by: Laszlo Bende --- .github/workflows/BuildPublishDocker.yml | 44 ++++++++++++++++++++++++ Dockerfile-kafkakewl-deploy | 14 ++++++++ Dockerfile-kafkakewl-metrics | 14 ++++++++ 3 files changed, 72 insertions(+) create mode 100644 .github/workflows/BuildPublishDocker.yml create mode 100644 Dockerfile-kafkakewl-deploy create mode 100644 Dockerfile-kafkakewl-metrics diff --git a/.github/workflows/BuildPublishDocker.yml b/.github/workflows/BuildPublishDocker.yml new file mode 100644 index 0000000..4926566 --- /dev/null +++ b/.github/workflows/BuildPublishDocker.yml @@ -0,0 +1,44 @@ +name: Build and publish the docker image +on: + push: + tags: + - 'v*' +jobs: + build-and-push-image: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - image: ghcr.io/marshallwace/kafkakewl-deploy + dockerfile: ./Dockerfile-kafkakewl-deploy + - image: ghcr.io/marshallwace/kafkakewl-metrics + dockerfile: ./Dockerfile-kafkakewl-metrics + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extracting metadata for the image + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ matrix.image }} + tags: | + type=ref,event=pr + type=semver,pattern={{version}} + - name: Build and Push tag + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.dockerfile }} + platforms: linux/amd64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + push: true \ No newline at end of file diff --git a/Dockerfile-kafkakewl-deploy b/Dockerfile-kafkakewl-deploy new file mode 100644 index 0000000..2806f2d --- /dev/null +++ b/Dockerfile-kafkakewl-deploy @@ -0,0 +1,14 @@ +FROM eclipse-temurin:21-jdk-ubi9-minimal + +# install some packages +RUN INSTALL_PKGS="findutils net-tools" \ + && microdnf install -y $INSTALL_PKGS \ + && rpm -V $INSTALL_PKGS \ + && microdnf clean all -y + +# building, testing, packaging +COPY . /usr/src/app +WORKDIR /usr/src/app +RUN ./gradlew build + +ENTRYPOINT ["java", "-jar", "kafkakewl-deploy/build/libs/kafkakewl-deploy-all.jar"] diff --git a/Dockerfile-kafkakewl-metrics b/Dockerfile-kafkakewl-metrics new file mode 100644 index 0000000..ee659ce --- /dev/null +++ b/Dockerfile-kafkakewl-metrics @@ -0,0 +1,14 @@ +FROM eclipse-temurin:21-jdk-ubi9-minimal + +# install some packages +RUN INSTALL_PKGS="findutils net-tools" \ + && microdnf install -y $INSTALL_PKGS \ + && rpm -V $INSTALL_PKGS \ + && microdnf clean all -y + +# building, testing, packaging +COPY . /usr/src/app +WORKDIR /usr/src/app +RUN ./gradlew build + +ENTRYPOINT ["java", "-jar", "kafkakewl-metrics/build/libs/kafkakewl-metrics-all.jar"]