diff --git a/.containerignore b/.containerignore new file mode 100644 index 00000000..1ad99637 --- /dev/null +++ b/.containerignore @@ -0,0 +1,2 @@ +* +!target/*.jar diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bae1359a..3dcf7a35 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,12 @@ updates: - "chore" - "safe-to-test" open-pull-requests-limit: 20 + + - package-ecosystem: "docker" + directory: "/src/main/container" + schedule: + interval: "weekly" + labels: + - "dependencies" + - "chore" + - "safe-to-test" diff --git a/.github/workflows/container-image.yml b/.github/workflows/container-image.yml index b3eaff05..301d1909 100644 --- a/.github/workflows/container-image.yml +++ b/.github/workflows/container-image.yml @@ -16,9 +16,9 @@ on: env: OPENSUSE_UNOFFICIAL_LIBCONTAINERS_KEY_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04/Release.key" OPENSUSE_UNOFFICIAL_LIBCONTAINERS_SOURCE_URL: "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04" - CI_USER: redhat-java-monitoring+github_ci - CI_REGISTRY: quay.io/redhat-java-monitoring - CI_IMG: quay.io/redhat-java-monitoring/quarkus-cryostat-agent + CI_USER: cryostat+bot + CI_REGISTRY: quay.io/cryostat + CI_IMG: quay.io/cryostat/cryostat-agent-init jobs: build-agent: @@ -36,7 +36,7 @@ jobs: echo "agent-version=$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)" >> $GITHUB_OUTPUT - uses: actions/setup-java@v4 with: - java-version: '17' + java-version: '11' distribution: 'temurin' - uses: actions/cache@v4 with: @@ -44,17 +44,12 @@ jobs: key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }} - run: mvn -B -U clean install - build-quarkus-test-app: + build-container: needs: [build-agent] runs-on: ubuntu-latest - strategy: - matrix: - java: ['17'] - outputs: - quay-image: ${{ steps.quarkus-test-image.outputs.image }} env: agent-version: ${{ needs.build-agent.outputs.image-version }} - name: Build Java ${{ matrix.java }} + name: Build container image steps: - uses: actions/checkout@v4 with: @@ -62,29 +57,15 @@ jobs: fetch-depth: 0 - name: Get date tag run: echo "DATE_TAG=$(date -uI)" >> "$GITHUB_ENV" - - uses: actions/cache@v4 - with: - path: ~/.m2 - key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-build- - ${{ runner.os }}- - uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + java-version: '11' distribution: 'temurin' - cache: 'maven' - - uses: actions/checkout@v4 + - uses: actions/cache@v4 with: - repository: ${{ github.repository_owner }}/test-applications - ref: main - submodules: true - fetch-depth: 0 - - name: Build application - working-directory: quarkus-agent - run: ./mvnw -B -U -Dio.cryostat.agent.version=${{ env.agent-version }} clean verify - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + path: ~/.m2 + key: ${{ runner.os }}-build-${{ hashFiles('**/pom.xml') }} + - run: mvn -B -U clean install - name: Build container images and manifest id: buildah-build uses: redhat-actions/buildah-build@v2 @@ -92,14 +73,13 @@ jobs: image: ${{ env.CI_IMG }} archs: amd64, arm64 tags: ${{ env.agent-version }} ${{env.DATE_TAG}} latest - context: quarkus-agent containerfiles: | - ./quarkus-agent/src/main/docker/Dockerfile.jvm + src/main/container/Dockerfile - name: Push to quay.io id: push-to-quay uses: redhat-actions/push-to-registry@v2 with: - image: quarkus-cryostat-agent + image: cryostat-agent-init tags: ${{ steps.buildah-build.outputs.tags }} registry: ${{ env.CI_REGISTRY }} username: ${{ env.CI_USER }} diff --git a/src/main/container/Dockerfile b/src/main/container/Dockerfile new file mode 100644 index 00000000..96450495 --- /dev/null +++ b/src/main/container/Dockerfile @@ -0,0 +1,5 @@ +ARG BASEIMAGE=registry.access.redhat.com/ubi8-micro:8.10 +FROM ${BASEIMAGE} +ARG OUTDIR=/cryostat/agent +COPY target/cryostat-agent-*-shaded.jar ${OUTDIR}/ +RUN ln -s ${OUTDIR}/cryostat-agent-*-shaded.jar ${OUTDIR}/cryostat-agent-shaded.jar