Skip to content

Commit 57378a1

Browse files
Index server base image build argument with Konflux argfile (#603)
* devfile index base image build argument Signed-off-by: Michael Valdron <mvaldron@redhat.com> * konflux argfile Signed-off-by: Michael Valdron <mvaldron@redhat.com> --------- Signed-off-by: Michael Valdron <mvaldron@redhat.com>
1 parent ad5f36a commit 57378a1

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed

.ci/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
ARG BASE_IMAGE=quay.io/devfile/devfile-index-base:next
16+
1517
FROM registry.access.redhat.com/ubi8/go-toolset:1.21 AS builder
1618

1719
# Set user as root
@@ -42,6 +44,6 @@ RUN bash /registry-support/build-tools/build.sh /registry /build
4244
# Set user as non-root
4345
USER 1001
4446

45-
FROM quay.io/devfile/devfile-index-base:next
47+
FROM ${BASE_IMAGE}
4648

4749
COPY --from=builder /build /registry

.ci/Dockerfile.offline

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
15+
ARG BASE_IMAGE=quay.io/devfile/devfile-index-base:next
16+
1517
FROM registry.access.redhat.com/ubi8/go-toolset:1.21 AS builder
1618

1719
# Set user as root
@@ -50,7 +52,7 @@ RUN bash /registry-support/build-tools/build.sh /registry /build
5052
# Extract archived resources
5153
RUN bash /registry-support/build-tools/extract_resources.sh
5254

53-
FROM quay.io/devfile/devfile-index-base:next
55+
FROM ${BASE_IMAGE}
5456

5557
# Set user as non-root
5658
USER 1001

.ci/build-multi-arch.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2020
# Due to command differences between podman and docker we need to separate the process
2121
# for creating and adding images to a multi-arch manifest
2222
podman=${USE_PODMAN:-false}
23+
# Base index server image
24+
BASE_IMAGE=${BASE_IMAGE:-'quay.io/devfile/devfile-index-base:next'}
2325
# Base Repository
2426
BASE_REPO="quay.io/devfile/devfile-index"
2527
BASE_TAG="next"
@@ -32,7 +34,7 @@ if [ ${podman} == true ]; then
3234

3335
podman manifest create "$DEFAULT_IMG"
3436

35-
podman build --platform="$PLATFORMS" --manifest "$DEFAULT_IMG" --no-cache -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
37+
podman build --platform="$PLATFORMS" --manifest "$DEFAULT_IMG" --no-cache --build-arg BASE_IMAGE=${BASE_IMAGE} -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
3638

3739
podman manifest push "$DEFAULT_IMG"
3840

@@ -45,7 +47,7 @@ else
4547

4648
docker buildx use index-builder
4749

48-
docker buildx build --push --platform="$PLATFORMS" --tag "$DEFAULT_IMG" --provenance=false --no-cache -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
50+
docker buildx build --push --platform="$PLATFORMS" --tag "$DEFAULT_IMG" --provenance=false --no-cache --build-arg BASE_IMAGE=${BASE_IMAGE} -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
4951

5052
docker buildx rm index-builder
5153

.ci/build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ shopt -s expand_aliases
1616

1717
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
1818
USE_PODMAN=${USE_PODMAN:-false}
19+
# Base index server image
20+
BASE_IMAGE=${BASE_IMAGE:-'quay.io/devfile/devfile-index-base:next'}
1921
DEFAULT_ARCH="linux/amd64"
2022

2123
# Check if different architecture was passed for image build
@@ -34,7 +36,7 @@ fi
3436

3537
if [ $# -eq 1 ] && [ $1 == "offline" ]
3638
then
37-
docker build --no-cache --platform "${arch}" -t devfile-index -f $ABSOLUTE_PATH/Dockerfile.offline $ABSOLUTE_PATH/..
39+
docker build --no-cache --platform "${arch}" -t devfile-index --build-arg BASE_IMAGE=${BASE_IMAGE} -f $ABSOLUTE_PATH/Dockerfile.offline $ABSOLUTE_PATH/..
3840
else
39-
docker build --no-cache --platform "${arch}" -t devfile-index -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
41+
docker build --no-cache --platform "${arch}" -t devfile-index --build-arg BASE_IMAGE=${BASE_IMAGE} -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/..
4042
fi

.ci/konflux.argfile.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Use Konflux built base image
2+
BASE_IMAGE=quay.io/redhat-services-prod/devfiles-tenant/devfile-registry-main/devfile-registry-base-main

.tekton/devfile-registry-main-pull-request.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ spec:
3030
value: .ci/Dockerfile
3131
- name: path-context
3232
value: .
33+
- name: build-args-file
34+
value: .ci/konflux.argfile.conf
3335
pipelineSpec:
3436
description: |
3537
This pipeline is ideal for building container images from a Containerfile while reducing network traffic.

.tekton/devfile-registry-main-push.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ spec:
2727
value: .ci/Dockerfile
2828
- name: path-context
2929
value: .
30+
- name: build-args-file
31+
value: .ci/konflux.argfile.conf
3032
pipelineSpec:
3133
description: |
3234
This pipeline is ideal for building container images from a Containerfile while reducing network traffic.

0 commit comments

Comments
 (0)