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

chore: Pre-build DevWorkspace templates for devfile v2 #518

Merged
merged 14 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ RUN ./index.sh > /build/devfiles/index.json
RUN ./list_referenced_images.sh devfiles > /build/devfiles/external_images.txt
RUN chmod -R g+rwX /build/devfiles

FROM docker.io/node:12.20.1-alpine3.12 as dwtemplates
vinokurig marked this conversation as resolved.
Show resolved Hide resolved
RUN apk add --no-cache bash && npm install -g @eclipse-che/che-theia-devworkspace-handler
vinokurig marked this conversation as resolved.
Show resolved Hide resolved
vinokurig marked this conversation as resolved.
Show resolved Hide resolved
COPY ./build/scripts /build/
COPY ./devfiles /build/devfiles
WORKDIR /build/
RUN ./generate_devworkspace_templates.sh

vinokurig marked this conversation as resolved.
Show resolved Hide resolved
FROM docker.io/httpd:2.4.43-alpine AS registry
RUN apk add --no-cache bash && \
# Allow htaccess
Expand All @@ -31,6 +38,7 @@ RUN apk add --no-cache bash && \
apk add --no-cache coreutils
COPY .htaccess README.md /usr/local/apache2/htdocs/
COPY --from=builder /build/devfiles /usr/local/apache2/htdocs/devfiles
COPY --from=dwtemplates /build/out /usr/local/apache2/htdocs/devfiles/v2/che-theia/
COPY ./images /usr/local/apache2/htdocs/images
COPY ./build/dockerfiles/entrypoint.sh /usr/bin/
ENTRYPOINT ["/usr/bin/entrypoint.sh"]
Expand Down
21 changes: 21 additions & 0 deletions build/scripts/generate_devworkspace_templates.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#
# Copyright (c) 2019-2021 Red Hat, Inc.
vinokurig marked this conversation as resolved.
Show resolved Hide resolved
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#

mkdir /build/out/
for dir in /build/devfiles/*/
do
devfile=$(cat ${dir}meta.yaml | grep "v2:")
if [ -n "$devfile" ]; then
dir=${dir%/}
dir=/build/out/${dir##*/}
mkdir ${dir}
npx @eclipse-che/che-theia-devworkspace-handler --devfile-url:${devfile##*v2: } --output-file:${dir}/meta.yaml
fi
done