From e2e01a1d3df3efb30cbb21ac965dafa3d30c68ee Mon Sep 17 00:00:00 2001 From: Michael Hoang Date: Tue, 1 Aug 2023 14:40:15 -0400 Subject: [PATCH] debugging offline build Signed-off-by: Michael Hoang --- .ci/Dockerfile.offline | 48 ++++++++++++++++++++++++++++++++++++++++++ .ci/build.sh | 7 +++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 .ci/Dockerfile.offline diff --git a/.ci/Dockerfile.offline b/.ci/Dockerfile.offline new file mode 100644 index 00000000..b78d45e8 --- /dev/null +++ b/.ci/Dockerfile.offline @@ -0,0 +1,48 @@ +# +# Copyright 2020-2023 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FROM registry.access.redhat.com/ubi8/go-toolset:1.18 AS builder + +# Set user as root +USER root + +# Install yq +RUN curl -sL -O https://github.com/mikefarah/yq/releases/download/v4.9.5/yq_linux_amd64 -o /usr/local/bin/yq && mv ./yq_linux_amd64 /usr/local/bin/yq && chmod +x /usr/local/bin/yq + +COPY . /registry + +# Download the registry build tools +RUN git clone https://github.com/devfile/registry-support.git /registry-support + +# Download all the offline parent devfiles +RUN bash /registry-support/build-tools/dl_parent_devfiles.sh + +# Download all the offline starter projects +RUN bash /registry-support/build-tools/dl_starter_projects.sh + +# Update all devfiles to use offline starter projects +RUN bash /registry-support/build-tools/update_devfiles_offline.sh + +# Run the registry build tools +RUN bash /registry-support/build-tools/build.sh /registry /build + +# Extract archived resources +RUN bash /registry-support/build-tools/extract_resources.sh + +FROM quay.io/devfile/devfile-index-base:next + +# Set user as non-root +USER 1001 + +COPY --from=builder /build /registry diff --git a/.ci/build.sh b/.ci/build.sh index 567f9617..bd22e634 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -15,4 +15,9 @@ ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/.. +if [ $# -eq 1 ] && [ $1 == "offline" ] +then + docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile.offline $ABSOLUTE_PATH/.. +else + docker build --no-cache -t devfile-index -f $ABSOLUTE_PATH/Dockerfile $ABSOLUTE_PATH/.. +fi