Skip to content

Commit

Permalink
JKNS-458: Add Konflux-compatible Dockerfile
Browse files Browse the repository at this point in the history
Adding a Dockerfile for testing the Jenkins client plugin that does not
rely on the OpenShift CI registry for base images. This will pay
dividends when we eventually build the Jenkins images and plugins on
Konflux, as this Dockerfile only uses productized images published on
registry.redhat.io.

This also adds a .dockerignore to ensure generated or test content is
not present when developers build this image themselves locally.

Signed-off-by: Adam Kaplan <adam.kaplan@redhat.com>
  • Loading branch information
adambkaplan committed Jun 21, 2024
1 parent 20f505a commit 2cea2ad
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.idea
target
PR-Testing/jpi/
openshift-client.iml
.classpath
.project
.settings
.DS_Store
.vscode
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ openshift-client.iml
.project
.settings
.DS_Store
.vscode
19 changes: 19 additions & 0 deletions Dockerfile.rhel8
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This Dockerfile creates a test image that builds the openshift-client plugin and installs it into
# the latest Jenkins image, replacing the official relased version of the OCP client plugin.
# The image is intended to be used by the CI system to test changes.

FROM registry.redhat.io/ubi8/openjdk-17:1.20 AS builder
WORKDIR /java/src/github.com/openshift/jenkins-client-plugin
# openjdk-17 image defaults the USER to jboss. Use --chown flag to set the owner of the copied
# files to jboss. Otherwise the files will be owned by root and the maven build will fail.
COPY --chown=jboss:jboss . .
RUN mvn --version && \
mvn clean package

# Use the latest Jenkins image as the base for the "runtime" image.
# The tag should be updated to reflect the appropriate OCP version being tested - often this
# will lag the current version of OCP under development.
FROM registry.redhat.io/ocp-tools-4/jenkins-rhel8:v4.14.0
RUN rm /opt/openshift/plugins/openshift-client.jpi
COPY --from=builder /java/src/github.com/openshift/jenkins-client-plugin/target/openshift-client.hpi /opt/openshift/plugins
RUN mv /opt/openshift/plugins/openshift-client.hpi /opt/openshift/plugins/openshift-client.jpi

0 comments on commit 2cea2ad

Please sign in to comment.