Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(image): add Dockerfile for agent carrier container image #390

Merged
merged 13 commits into from
Jul 12, 2024
2 changes: 2 additions & 0 deletions .containerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!target/*.jar
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
46 changes: 13 additions & 33 deletions .github/workflows/container-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -36,70 +36,50 @@ 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:
path: ~/.m2
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:
submodules: true
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
with:
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 }}
Expand Down
5 changes: 5 additions & 0 deletions src/main/container/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Loading