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

add dockerfile to support offline registry builds #197

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .ci/Dockerfile.offline
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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