Skip to content

Commit

Permalink
Dockerfile ARGs for konflux builds
Browse files Browse the repository at this point in the history
Add a dockerfile arguments that satisfies konflux's build pipeline
The main difference to the main docker file is trusted base images and
must-have labels

Signed-off-by: Roy Golan <[email protected]>
  • Loading branch information
rgolangh committed Jun 18, 2024
1 parent 806e8fa commit 8e6648b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .tekton/move2kube-serverless-workflow-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ metadata:
spec:
params:
- name: dockerfile
value: pipeline/workflow-builder.Dockerfile
value: pipeline/workflow-builder.konflux.Dockerfile
- name: git-url
value: '{{source_url}}'
- name: output-image
Expand All @@ -27,6 +27,8 @@ spec:
value: move2kube
- name: revision
value: '{{revision}}'
- name: build-args-file
value: move2kube/argfile.conf
pipelineSpec:
finally:
- name: show-sbom
Expand Down
4 changes: 3 additions & 1 deletion .tekton/mta-serverless-workflow-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ metadata:
spec:
params:
- name: dockerfile
value: pipeline/workflow-builder.Dockerfile
value: pipeline/workflow-builder.konflux.Dockerfile
- name: git-url
value: '{{source_url}}'
- name: output-image
Expand All @@ -27,6 +27,8 @@ spec:
value: mta
- name: revision
value: '{{revision}}'
- name: build-args-file
value: mta/argfile.conf
pipelineSpec:
finally:
- name: show-sbom
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ prepare-workdir:
# Depends on: prepare-workdir target.
# Usage: make build-image
ifeq ($(IS_WORKFLOW),true)
build-image: BUILD_ARGS=--build-arg WF_RESOURCES=$(WORKFLOW_ID) --build-arg=QUARKUS_EXTENSIONS=$(QUARKUS_EXTENSIONS) --build-arg=MAVEN_ARGS_APPEND=$(MAVEN_ARGS_APPEND)
build-image: BUILD_ARGS=--build-arg-file=$(WORKFLOW_ID)/argfile.conf --build-arg=BUILDER_IMAGE= --build-arg WF_RESOURCES=$(WORKFLOW_ID) --build-arg=QUARKUS_EXTENSIONS=$(QUARKUS_EXTENSIONS) --build-arg=MAVEN_ARGS_APPEND=$(MAVEN_ARGS_APPEND)
endif
build-image: EXTRA_ARGS=--ulimit nofile=4096:4096
build-image: prepare-workdir
Expand Down Expand Up @@ -183,4 +183,4 @@ gen-manifests: prepare-workdir
push-manifests: prepare-workdir
cd $(WORKDIR)
@$(CONTAINER_ENGINE) run --rm -v $(WORKDIR):/workdir -w /workdir \
$(LINUX_IMAGE) /bin/bash -c "${SCRIPTS_DIR}/push_manifests.sh '$(GIT_USER_NAME)' $(GIT_USER_EMAIL) $(GIT_TOKEN) $(PR_OR_COMMIT_URL) $(DEPLOYMENT_REPO) $(DEPLOYMENT_BRANCH) $(WORKFLOW_ID) $(APPLICATION_ID) $(IMAGE_NAME) $(IMAGE_TAG)"
$(LINUX_IMAGE) /bin/bash -c "${SCRIPTS_DIR}/push_manifests.sh '$(GIT_USER_NAME)' $(GIT_USER_EMAIL) $(GIT_TOKEN) $(PR_OR_COMMIT_URL) $(DEPLOYMENT_REPO) $(DEPLOYMENT_BRANCH) $(WORKFLOW_ID) $(APPLICATION_ID) $(IMAGE_NAME) $(IMAGE_TAG)"
4 changes: 4 additions & 0 deletions move2kube/argfile.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BUILDER_IMAGE=brew.registry.redhat.io/rh-osbs/openshift-serverless-1-logic-swf-builder-rhel8@sha256:012439f21f964478225a459042f6e1dc14f63fdf4ae089c4ee5e613814682a27
FLOW_NAME=move2kube Serverless Workflow
FLOW_SUMMARY=move2kube Serverless Workflow
FLOW_DESCRIPTION=move2kube workflow consumes a source code repo and pushes a branch with manifests and build files to containerize and application
4 changes: 4 additions & 0 deletions mta/argfile.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BUILDER_IMAGE=brew.registry.redhat.io/rh-osbs/openshift-serverless-1-logic-swf-builder-rhel8@sha256:012439f21f964478225a459042f6e1dc14f63fdf4ae089c4ee5e613814682a27
FLOW_NAME=MTA Analysis
FLOW_SUMMARY=MTA Analysis serverless workflow consumes a source code repository and executes an MTA analysis using Migration ToolKit for Applications
FLOW_DESCRIPTION=MTA Analysis serverless workflow consumes a source code repository and executes an MTA analysis using Migration ToolKit for Applications
12 changes: 12 additions & 0 deletions pipeline/move2kube.dockerfile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# ARG WF_RESOURCES=move2kube

#include "pipeline/workflow-builder.konflux.Dockerfile.in"

LABEL name="move2kube serverless workflow"
LABEL summary="move2kube serverless workflow that takes a github project and proposes manifests and build files for containerization"
LABEL description="A workflow that takes a github project and proposses a pull request with manifests and build files for containerization using move2kube tool."
LABEL io.k8s.description="A workflow that takes a github project and proposses a pull request with manifests and build files for containerization using move2kube tool."
LABEL io.k8s.display-name="move2kube serverless workflow"
LABEL io.openshift.tags=""


16 changes: 15 additions & 1 deletion pipeline/workflow-builder.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# FROM registry.redhat.io/openshift-serverless-1-tech-preview/logic-swf-builder-rhel8@sha256:d19b3ecaeac10e6aa03530008d25c8171254d561dc5519b9efd18dd4f0de5675 AS builder
# Using the builder image below to address bugs https://issues.redhat.com/browse/FLPATH-1141 and https://issues.redhat.com/browse/FLPATH-1127
FROM quay.io/kiegroup/kogito-swf-builder:9.99.1.CR1 AS builder

ARG BUILDER_IMAGE

FROM ${BUILDER_IMAGE:-kogito-swf-builder:9.99.1.CR1} AS builder

# Temp hack to provide persistence artifacts - with quay.io/kiegroup/kogito-swf-builder:9.99.1.CR1 those dependencies are included in the base image.
#ENV MAVEN_REPO_URL=https://maven.repository.redhat.com/earlyaccess/all
Expand Down Expand Up @@ -33,6 +36,10 @@ RUN /home/kogito/launch/build-app.sh ./resources
#=============================
FROM registry.access.redhat.com/ubi8/openjdk-17:1.19-4.1715070735

ARG FLOW_NAME
ARG FLOW_SUMMARY
ARG FLOW_DESCRIPTION

ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en'

# We make four distinct layers so if there are application changes the library layers can be re-used
Expand All @@ -47,3 +54,10 @@ USER 185
ENV AB_JOLOKIA_OFF=""
ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
ENV JAVA_APP_JAR="/deployments/quarkus-run.jar"

LABEL name="${FLOW_NAME}"
LABEL summary="${FLOW_SUMMARY}"
LABEL description="${FLOW_DESCRIPTION}"
LABEL io.k8s.description="${FLOW_DESCRIPTION}"
LABEL io.k8s.display-name="${FLOW_NAME}"
LABEL io.openshift.tags=""

0 comments on commit 8e6648b

Please sign in to comment.