From 45a0c238e9439f8aaa3746add76c3514ec31512e Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Fri, 31 May 2019 20:08:55 +0300 Subject: [PATCH 1/6] Make binare for remote-plugin-endpoint Signed-off-by: Oleksandr Andriienko --- dockerfiles/theia-endpoint-runtime/Dockerfile | 45 +++++++++++++++---- .../src/node/che-plugin-api-provider.ts | 10 ++++- .../src/node/plugin-remote-backend-module.ts | 9 ++++ 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 27baf5307..7bad0672d 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -50,13 +50,23 @@ COPY /docker-build/theia-plugin-remote/tsconfig.json /home/workspace/packages/th COPY /etc/package.json /home/workspace RUN cd /home/workspace/ && yarn install -FROM node:10.15-alpine +RUN yarn global add nexe@3.2.0 && nexe -v +WORKDIR /home/workspace + +# Fix theia-plugin-ext dependency +RUN rm -rf /home/workspace/node_modules/@eclipse-che/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-remote +RUN cp -rf /home/workspace/packages/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-plugin-ext + +RUN nexe packages/theia-remote/lib/node/plugin-remote.js -t alpine-x64-10.14.2 -o plugin-remote +RUN ls + + +FROM registry.access.redhat.com/ubi8/ubi-minimal + ENV HOME=/home/theia -COPY --from=builder /home/workspace/node_modules /home/theia/node_modules -RUN rm -rf /home/theia/node_modules/@eclipse-che/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-remote -COPY --from=builder /home/workspace/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext -COPY --from=builder /home/workspace/packages/theia-remote/lib /home/theia/lib -RUN mkdir /projects \ +COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +RUN mkdir /projects /home/theia \ # Store passwd/group as template files && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ @@ -65,6 +75,25 @@ RUN mkdir /projects \ echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ chmod -R g+rwX ${f}; \ done -ADD etc/entrypoint.sh /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] + +ENTRYPOINT /plugin-remote + + +# FROM node:10.15-alpine +# ENV HOME=/home/theia +# COPY --from=builder /home/workspace/node_modules /home/theia/node_modules +# RUN rm -rf /home/theia/node_modules/@eclipse-che/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-remote +# COPY --from=builder /home/workspace/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext +# COPY --from=builder /home/workspace/packages/theia-remote/lib /home/theia/lib +# RUN mkdir /projects \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] diff --git a/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts b/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts index f90a293d3..7cef577b2 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts @@ -10,19 +10,25 @@ import { ExtPluginApiProvider, ExtPluginApi } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; import { injectable } from 'inversify'; -import * as path from 'path'; +// import * as path from 'path'; + +export function Text2() { + console.log('>>>>>>>>>>>>>>>>>>>>>>Here I am!!!!!!!!!!!!1'); +} @injectable() export class ChePluginApiProvider implements ExtPluginApiProvider { provideApi(): ExtPluginApi { + console.log('provide che plugin api!!!'); return { frontendExtApi: { initPath: '/che/api/che-api-worker-provider.js', initFunction: 'initializeApi', initVariable: 'che_api_provider' }, - backendInitPath: path.join(__dirname, '../plugin/node/che-api-node-provider.js') + // backendInitPath: path.join(__dirname, '../plugin/node/che-api-node-provider.js') + backendInitPath: '@eclipse-che/theia-plugin-ext/lib/plugin/node/che-api-node-provider.js' }; } diff --git a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts index 283342698..068592ce5 100644 --- a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts +++ b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts @@ -22,6 +22,15 @@ const localModule = ConnectionContainerModule.create(({ bind }) => { }); export default new ContainerModule(bind => { + try { + const cheApiNodeProvider = require('@eclipse-che/theia-plugin-ext/lib/plugin/node/che-api-node-provider.js'); + console.log('Che Api node!!! ', cheApiNodeProvider); + const cheApi = require('@eclipse-che/theia-plugin-ext/lib/node/che-plugin-api-provider.js'); + cheApi.Text2(); + } catch (err) { + console.log('>>>>Error2', err); + } + bind(HostedPluginMapping).toSelf().inSingletonScope(); bind(MetadataProcessor).to(RemoteMetadataProcessor).inSingletonScope(); bind(ConnectionContainerModule).toConstantValue(localModule); From 99ae354ed9586918703026eec7f0c8ce18d01267 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Mon, 3 Jun 2019 23:37:36 +0300 Subject: [PATCH 2/6] Improve code. Test a lot images. Signed-off-by: Oleksandr Andriienko --- che-theia-init-sources.yml | 2 +- dockerfiles/build.include | 2 +- dockerfiles/theia-dev/e2e/Dockerfile | 2 +- dockerfiles/theia-endpoint-runtime/Dockerfile | 304 +++++++++++++++++- dockerfiles/theia-endpoint-runtime/build.sh | 2 + .../theia-endpoint-runtime/etc/entrypoint.sh | 6 +- dockerfiles/theia-endpoint-runtime/push.sh | 3 + dockerfiles/theia-endpoint-runtime/retag.sh | 3 + .../src/node/che-plugin-api-provider.ts | 6 - .../src/node/plugin-remote-backend-module.ts | 8 +- 10 files changed, 317 insertions(+), 21 deletions(-) create mode 100755 dockerfiles/theia-endpoint-runtime/push.sh create mode 100755 dockerfiles/theia-endpoint-runtime/retag.sh diff --git a/che-theia-init-sources.yml b/che-theia-init-sources.yml index 989c818d6..a08beeca7 100644 --- a/che-theia-init-sources.yml +++ b/che-theia-init-sources.yml @@ -17,4 +17,4 @@ sources: - plugins/ports-plugin - plugins/task-plugin - plugins/welcome-plugin - checkoutTo: master + checkoutTo: remoteBinary diff --git a/dockerfiles/build.include b/dockerfiles/build.include index 32dca4054..844c3f34e 100755 --- a/dockerfiles/build.include +++ b/dockerfiles/build.include @@ -139,7 +139,7 @@ build_image() { printf "${BOLD}Building Docker Image ${IMAGE_NAME} from $DIR directory with tag $TAG${NC}\n" # Replace macros in Dockerfiles cat ${DIR}/${DOCKERFILE} | sed s/\$\{BUILD_ORGANIZATION\}/${ORGANIZATION}/ | sed s/\$\{BUILD_PREFIX\}/${PREFIX}/ | sed s/\$\{BUILD_TAG\}/${TAG}/ | sed s/\$\{BUILD_PARENT_IMAGE\}/${PARENT_IMAGE}/ | sed s/\$\{GIT_BRANCH_NAME\}/${BRANCH}/ | sed s/\$\{GIT_REF\}/"${GIT_REF}"/ > ${DIR}/.Dockerfile - cd "${DIR}" && docker build -f ${DIR}/.Dockerfile -t ${IMAGE_NAME} ${BUILD_ARGS} . + cd "${DIR}" && docker build -f ${DIR}/.Dockerfile --no-cache -t ${IMAGE_NAME} ${BUILD_ARGS} . rm ${DIR}/.Dockerfile if [ $? -eq 0 ]; then printf "Build of ${BLUE}${IMAGE_NAME} ${GREEN}[OK]${NC}\n" diff --git a/dockerfiles/theia-dev/e2e/Dockerfile b/dockerfiles/theia-dev/e2e/Dockerfile index 31b0454fe..2597734f4 100644 --- a/dockerfiles/theia-dev/e2e/Dockerfile +++ b/dockerfiles/theia-dev/e2e/Dockerfile @@ -12,6 +12,6 @@ FROM ${BUILD_ORGANIZATION}/${BUILD_PREFIX}-theia-dev:${BUILD_TAG} ARG GITHUB_TOKEN # Just try to build the latest theia with current image -RUN git clone -b 'master' --single-branch --depth 1 https://github.com/theia-ide/theia theia +RUN git clone -b 'v0.7.0' --single-branch --depth 1 https://github.com/theia-ide/theia theia RUN cd theia && yarn diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 7bad0672d..8c99cb9a9 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -58,12 +58,10 @@ RUN rm -rf /home/workspace/node_modules/@eclipse-che/theia-plugin-ext /home/work RUN cp -rf /home/workspace/packages/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-plugin-ext RUN nexe packages/theia-remote/lib/node/plugin-remote.js -t alpine-x64-10.14.2 -o plugin-remote -RUN ls FROM registry.access.redhat.com/ubi8/ubi-minimal -ENV HOME=/home/theia COPY --from=builder /home/workspace/plugin-remote /plugin-remote RUN mkdir /projects /home/theia \ @@ -76,11 +74,113 @@ RUN mkdir /projects /home/theia \ chmod -R g+rwX ${f}; \ done -ENTRYPOINT /plugin-remote +ADD etc/entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] +# FROM alpine + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM ubuntu:18.04 + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM debian:9 + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM fedora:30 + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM centos:7 + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM busybox + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] # FROM node:10.15-alpine -# ENV HOME=/home/theia + # COPY --from=builder /home/workspace/node_modules /home/theia/node_modules # RUN rm -rf /home/theia/node_modules/@eclipse-che/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-remote # COPY --from=builder /home/workspace/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext @@ -97,3 +197,199 @@ ENTRYPOINT /plugin-remote # ADD etc/entrypoint.sh /entrypoint.sh # ENTRYPOINT ["/entrypoint.sh"] +# opensuse/leap because opensuse depracated +# FROM opensuse/leap + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM cirros + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM clefos + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM mageia:7 + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM photon:latest + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + + +# FROM photon:latest + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# # alt os +# FROM alt + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + + +# FROM amazonlinux + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM open-liberty + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# ENTRYPOINT [ "/plugin-remote" ] + +# FROM php + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM oraclelinux + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] + +# FROM golang:stretch + +# COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +# RUN mkdir /projects /home/theia \ +# # Store passwd/group as template files +# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ +# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ +# # Change permissions to let any arbitrary user +# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ +# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ +# chmod -R g+rwX ${f}; \ +# done + +# ADD etc/entrypoint.sh /entrypoint.sh +# ENTRYPOINT ["/entrypoint.sh"] diff --git a/dockerfiles/theia-endpoint-runtime/build.sh b/dockerfiles/theia-endpoint-runtime/build.sh index cf2882fd4..08a4a683f 100755 --- a/dockerfiles/theia-endpoint-runtime/build.sh +++ b/dockerfiles/theia-endpoint-runtime/build.sh @@ -44,3 +44,5 @@ cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/tsconfig.jso init --name:theia-endpoint-runtime "$@" build + +./retag.sh diff --git a/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh b/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh index 1f85f5768..f8fd0f2ab 100755 --- a/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh +++ b/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh @@ -38,7 +38,7 @@ fi responsible_shutdown() { echo "" echo "Received SIGTERM" - kill -SIGINT ${PID} + kill -INT ${PID} wait ${PID} exit; } @@ -47,12 +47,12 @@ set -e # setup handlers # on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler -trap 'responsible_shutdown' SIGHUP SIGTERM SIGINT +trap 'responsible_shutdown' HUP TERM INT cd ${HOME} # run theia endpoint -node /home/theia/lib/node/plugin-remote.js & +/plugin-remote & PID=$! diff --git a/dockerfiles/theia-endpoint-runtime/push.sh b/dockerfiles/theia-endpoint-runtime/push.sh new file mode 100755 index 000000000..a7578b7f9 --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime/push.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker push aandrienko/che-theia-remote:next \ No newline at end of file diff --git a/dockerfiles/theia-endpoint-runtime/retag.sh b/dockerfiles/theia-endpoint-runtime/retag.sh new file mode 100755 index 000000000..0e750fac4 --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime/retag.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +docker tag eclipse/che-theia-endpoint-runtime:nightly aandrienko/che-theia-remote:next diff --git a/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts b/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts index 7cef577b2..4144d79c1 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts @@ -10,11 +10,6 @@ import { ExtPluginApiProvider, ExtPluginApi } from '@theia/plugin-ext/lib/common/plugin-ext-api-contribution'; import { injectable } from 'inversify'; -// import * as path from 'path'; - -export function Text2() { - console.log('>>>>>>>>>>>>>>>>>>>>>>Here I am!!!!!!!!!!!!1'); -} @injectable() export class ChePluginApiProvider implements ExtPluginApiProvider { @@ -27,7 +22,6 @@ export class ChePluginApiProvider implements ExtPluginApiProvider { initFunction: 'initializeApi', initVariable: 'che_api_provider' }, - // backendInitPath: path.join(__dirname, '../plugin/node/che-api-node-provider.js') backendInitPath: '@eclipse-che/theia-plugin-ext/lib/plugin/node/che-api-node-provider.js' }; } diff --git a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts index 068592ce5..9af925528 100644 --- a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts +++ b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts @@ -23,12 +23,10 @@ const localModule = ConnectionContainerModule.create(({ bind }) => { export default new ContainerModule(bind => { try { - const cheApiNodeProvider = require('@eclipse-che/theia-plugin-ext/lib/plugin/node/che-api-node-provider.js'); - console.log('Che Api node!!! ', cheApiNodeProvider); - const cheApi = require('@eclipse-che/theia-plugin-ext/lib/node/che-plugin-api-provider.js'); - cheApi.Text2(); + // Force nexe to include theia-plugin-ext iside binary + require('@eclipse-che/theia-plugin-ext/lib/node/che-plugin-api-provider.js'); } catch (err) { - console.log('>>>>Error2', err); + console.log('Unable to set up che theia plugin api: ', err); } bind(HostedPluginMapping).toSelf().inSingletonScope(); From 0c8dd2d5e3bee04a82269c93c926845b028c5db0 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Fri, 7 Jun 2019 23:18:31 +0300 Subject: [PATCH 3/6] Created separated docker file for remote-plugin-binary. Signed-off-by: Oleksandr Andriienko --- build_and_push_docker_images.sh | 2 + dockerfiles/theia-dev/e2e/Dockerfile | 2 +- .../theia-endpoint-runtime-binary/.gitignore | 8 + .../theia-endpoint-runtime-binary/Dockerfile | 78 ++++ .../theia-endpoint-runtime-binary/build.sh | 48 +++ .../etc/entrypoint.sh | 68 ++++ .../etc/package.json | 21 ++ .../push.sh | 0 .../retag.sh | 0 dockerfiles/theia-endpoint-runtime/Dockerfile | 340 +----------------- dockerfiles/theia-endpoint-runtime/build.sh | 2 - .../theia-endpoint-runtime/etc/entrypoint.sh | 6 +- 12 files changed, 236 insertions(+), 339 deletions(-) create mode 100644 dockerfiles/theia-endpoint-runtime-binary/.gitignore create mode 100644 dockerfiles/theia-endpoint-runtime-binary/Dockerfile create mode 100755 dockerfiles/theia-endpoint-runtime-binary/build.sh create mode 100755 dockerfiles/theia-endpoint-runtime-binary/etc/entrypoint.sh create mode 100644 dockerfiles/theia-endpoint-runtime-binary/etc/package.json rename dockerfiles/{theia-endpoint-runtime => theia-endpoint-runtime-binary}/push.sh (100%) rename dockerfiles/{theia-endpoint-runtime => theia-endpoint-runtime-binary}/retag.sh (100%) diff --git a/build_and_push_docker_images.sh b/build_and_push_docker_images.sh index 04a3b7bb6..20ce378a4 100755 --- a/build_and_push_docker_images.sh +++ b/build_and_push_docker_images.sh @@ -17,6 +17,7 @@ DOCKER_FILES_LOCATIONS=( dockerfiles/theia-dev dockerfiles/theia dockerfiles/theia-endpoint-runtime +dockerfiles/theia-endpoint-runtime-binary dockerfiles/remote-plugin-java8 dockerfiles/remote-plugin-java11 dockerfiles/remote-plugin-go-1.10.7 @@ -32,6 +33,7 @@ IMAGES_LIST=( eclipse/che-theia-dev eclipse/che-theia eclipse/che-theia-endpoint-runtime +eclipse/che-theia-endpoint-runtime-binary eclipse/che-remote-plugin-runner-java8 eclipse/che-remote-plugin-runner-java11 eclipse/che-remote-plugin-go-1.10.7 diff --git a/dockerfiles/theia-dev/e2e/Dockerfile b/dockerfiles/theia-dev/e2e/Dockerfile index 2597734f4..31b0454fe 100644 --- a/dockerfiles/theia-dev/e2e/Dockerfile +++ b/dockerfiles/theia-dev/e2e/Dockerfile @@ -12,6 +12,6 @@ FROM ${BUILD_ORGANIZATION}/${BUILD_PREFIX}-theia-dev:${BUILD_TAG} ARG GITHUB_TOKEN # Just try to build the latest theia with current image -RUN git clone -b 'v0.7.0' --single-branch --depth 1 https://github.com/theia-ide/theia theia +RUN git clone -b 'master' --single-branch --depth 1 https://github.com/theia-ide/theia theia RUN cd theia && yarn diff --git a/dockerfiles/theia-endpoint-runtime-binary/.gitignore b/dockerfiles/theia-endpoint-runtime-binary/.gitignore new file mode 100644 index 000000000..9d991d754 --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime-binary/.gitignore @@ -0,0 +1,8 @@ +theia-plugin-ext +docker-build +.browser_modules +*.log +*-app/* +!*-app/package.json +.idea +.Dockerfile diff --git a/dockerfiles/theia-endpoint-runtime-binary/Dockerfile b/dockerfiles/theia-endpoint-runtime-binary/Dockerfile new file mode 100644 index 000000000..c95d24e1f --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime-binary/Dockerfile @@ -0,0 +1,78 @@ +# Copyright (c) 2019 Red Hat, Inc. +# 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 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation + +FROM ${BUILD_ORGANIZATION}/${BUILD_PREFIX}-theia-dev:${BUILD_TAG} as builder + + +# define in env variable GITHUB_TOKEN only if it is defined +# else check if github rate limit is enough, else will abort requiring to set GITHUB_TOKEN value +ARG GITHUB_TOKEN + +# Check github limit +RUN if [ ! -z "${GITHUB_TOKEN-}" ]; then \ + export GITHUB_TOKEN=$GITHUB_TOKEN; \ + echo "Setting GITHUB_TOKEN value as provided"; \ + else \ + export GITHUB_LIMIT=$(curl -s 'https://api.github.com/rate_limit' | jq '.rate .remaining'); \ + echo "Current API rate limit https://api.github.com is ${GITHUB_LIMIT}"; \ + if [ "${GITHUB_LIMIT}" -lt 10 ]; then \ + printf "\033[0;31m\n\n\nRate limit on https://api.github.com is reached so in order to build this image, "; \ + printf "the build argument GITHUB_TOKEN needs to be provided so build will not fail.\n\n\n\033[0m"; \ + exit 1; \ + else \ + echo "GITHUB_TOKEN variable is not set but https://api.github.com rate limit has enough slots"; \ + fi \ + fi + +#invalidate cashe +ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/theia-ide/theia/git/refs/head /tmp/branch_info.json +ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/eclipse/che-theia/git/refs/head /tmp/branch_info.json + +# Grab dependencies +COPY /docker-build/theia-plugin-remote/package.json /home/workspace/packages/theia-remote/ +RUN cd /home/workspace/packages/theia-remote/ && yarn install --ignore-scripts + +# Compile +COPY /docker-build/configs /home/workspace/configs +COPY /docker-build/theia-plugin-remote/*.json /home/workspace/packages/theia-remote/ +COPY /docker-build/theia-plugin-remote/src /home/workspace/packages/theia-remote/src +COPY /docker-build/theia-plugin-ext /home/workspace/packages/theia-plugin-ext +COPY /docker-build/theia-plugin /home/workspace/packages/theia-plugin +COPY /docker-build/theia-plugin-remote/tsconfig.json /home/workspace/packages/theia-plugin/tsconfig.json + +COPY /etc/package.json /home/workspace +RUN cd /home/workspace/ && yarn install + +RUN yarn global add nexe@3.2.0 && nexe -v +WORKDIR /home/workspace + +# Fix theia-plugin-ext dependency +RUN rm -rf /home/workspace/node_modules/@eclipse-che/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-remote +RUN cp -rf /home/workspace/packages/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-plugin-ext + +RUN nexe packages/theia-remote/lib/node/plugin-remote.js -t alpine-x64-10.14.2 -o plugin-remote + + +FROM registry.access.redhat.com/ubi8/ubi-minimal + +COPY --from=builder /home/workspace/plugin-remote /plugin-remote + +RUN mkdir /projects /home/theia \ + # Store passwd/group as template files + && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ + && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ + # Change permissions to let any arbitrary user + && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ + echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ + chmod -R g+rwX ${f}; \ + done + +ADD etc/entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/dockerfiles/theia-endpoint-runtime-binary/build.sh b/dockerfiles/theia-endpoint-runtime-binary/build.sh new file mode 100755 index 000000000..08a4a683f --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime-binary/build.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (c) 2019 Red Hat, Inc. +# 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 + +base_dir=$(cd "$(dirname "$0")"; pwd) +. "${base_dir}"/../build.include + +DIR=$(cd "$(dirname "$0")"; pwd) +LOCAL_ASSEMBLY_DIR="${DIR}"/docker-build + +if [ -d "${LOCAL_ASSEMBLY_DIR}" ]; then + rm -rf "${LOCAL_ASSEMBLY_DIR}" +fi + +#in mac os 'cp' cannot create destination dir, so create it first +mkdir ${LOCAL_ASSEMBLY_DIR} + +echo "Copying ${base_dir}/../../extensions/eclipse-che-theia-plugin --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin" +mkdir ${LOCAL_ASSEMBLY_DIR}/theia-plugin +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin/src/" +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin" + +echo "Copying ${base_dir}/../../extensions/eclipse-che-theia-plugin-ext --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +mkdir ${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext/src/" +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/webpack.config.js" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" + +echo "Copying ${base_dir}/../../configs --> ${LOCAL_ASSEMBLY_DIR}/configs" +cp -r "${base_dir}/../../configs/." "${LOCAL_ASSEMBLY_DIR}/configs" + +echo "Copying ${base_dir}/../../extensions/eclipse-che-theia-plugin-remote --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" +mkdir ${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote/src/" +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" +cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" + + +init --name:theia-endpoint-runtime "$@" +build + +./retag.sh diff --git a/dockerfiles/theia-endpoint-runtime-binary/etc/entrypoint.sh b/dockerfiles/theia-endpoint-runtime-binary/etc/entrypoint.sh new file mode 100755 index 000000000..f8fd0f2ab --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime-binary/etc/entrypoint.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# +# Copyright (c) 2018-2019 Red Hat, Inc. +# 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 +# +# Contributors: +# Red Hat, Inc. - initial API and implementation +# + +export USER_ID=$(id -u) +export GROUP_ID=$(id -g) + +if ! grep -Fq "${USER_ID}" /etc/passwd; then + # current user is an arbitrary + # user (its uid is not in the + # container /etc/passwd). Let's fix that + cat ${HOME}/passwd.template | \ + sed "s/\${USER_ID}/${USER_ID}/g" | \ + sed "s/\${GROUP_ID}/${GROUP_ID}/g" | \ + sed "s/\${HOME}/\/home\/theia/g" > /etc/passwd + + cat ${HOME}/group.template | \ + sed "s/\${USER_ID}/${USER_ID}/g" | \ + sed "s/\${GROUP_ID}/${GROUP_ID}/g" | \ + sed "s/\${HOME}/\/home\/theia/g" > /etc/group +fi + +# Grant access to projects volume in case of non root user with sudo rights +if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1 && sudo -n true > /dev/null 2>&1; then + sudo chown ${USER_ID}:${GROUP_ID} /projects +fi + +# SITTERM / SIGINT +responsible_shutdown() { + echo "" + echo "Received SIGTERM" + kill -INT ${PID} + wait ${PID} + exit; +} + +set -e + +# setup handlers +# on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler +trap 'responsible_shutdown' HUP TERM INT + +cd ${HOME} + +# run theia endpoint +/plugin-remote & + +PID=$! + +# See: http://veithen.github.io/2014/11/16/sigterm-propagation.html +wait ${PID} +wait ${PID} +EXIT_STATUS=$? + +# wait forever +while true +do + tail -f /dev/null & wait ${!} +done diff --git a/dockerfiles/theia-endpoint-runtime-binary/etc/package.json b/dockerfiles/theia-endpoint-runtime-binary/etc/package.json new file mode 100644 index 000000000..2905aacf3 --- /dev/null +++ b/dockerfiles/theia-endpoint-runtime-binary/etc/package.json @@ -0,0 +1,21 @@ + { + "private": true, + "workspaces": [ + "packages/*" + ], + "devDependencies": { + "tslint": "5.10.0", + "rimraf": "2.6.2", + "typescript": "3.1.3", + "typescript-formatter": "7.2.2" + }, + "scripts": { + "prepare": "yarn run clean && yarn run tslint && yarn run build", + "tslint-fix": "tslint --fix --project packages/theia-remote", + "tslint": "tslint --project packages/theia-remote", + "clean": "rimraf packages/**/lib", + "format-code": "tsfmt -r --baseDir packages/theia-remote && tsfmt -r --baseDir packages/theia-plugin-ext", + "compile": "tsc -b packages/**", + "build": "yarn run format-code && yarn run compile && yarn run tslint-fix" + } + } diff --git a/dockerfiles/theia-endpoint-runtime/push.sh b/dockerfiles/theia-endpoint-runtime-binary/push.sh similarity index 100% rename from dockerfiles/theia-endpoint-runtime/push.sh rename to dockerfiles/theia-endpoint-runtime-binary/push.sh diff --git a/dockerfiles/theia-endpoint-runtime/retag.sh b/dockerfiles/theia-endpoint-runtime-binary/retag.sh similarity index 100% rename from dockerfiles/theia-endpoint-runtime/retag.sh rename to dockerfiles/theia-endpoint-runtime-binary/retag.sh diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 8c99cb9a9..380b07908 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -50,21 +50,13 @@ COPY /docker-build/theia-plugin-remote/tsconfig.json /home/workspace/packages/th COPY /etc/package.json /home/workspace RUN cd /home/workspace/ && yarn install -RUN yarn global add nexe@3.2.0 && nexe -v -WORKDIR /home/workspace - -# Fix theia-plugin-ext dependency -RUN rm -rf /home/workspace/node_modules/@eclipse-che/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-remote -RUN cp -rf /home/workspace/packages/theia-plugin-ext /home/workspace/node_modules/@eclipse-che/theia-plugin-ext - -RUN nexe packages/theia-remote/lib/node/plugin-remote.js -t alpine-x64-10.14.2 -o plugin-remote - - -FROM registry.access.redhat.com/ubi8/ubi-minimal - -COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -RUN mkdir /projects /home/theia \ +FROM node:10.15-alpine +ENV HOME=/home/theia +COPY --from=builder /home/workspace/node_modules /home/theia/node_modules +RUN rm -rf /home/theia/node_modules/@eclipse-che/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-remote +COPY --from=builder /home/workspace/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext +COPY --from=builder /home/workspace/packages/theia-remote/lib /home/theia/lib +RUN mkdir /projects \ # Store passwd/group as template files && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ @@ -73,323 +65,5 @@ RUN mkdir /projects /home/theia \ echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ chmod -R g+rwX ${f}; \ done - ADD etc/entrypoint.sh /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"] - -# FROM alpine - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM ubuntu:18.04 - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM debian:9 - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM fedora:30 - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM centos:7 - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM busybox - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM node:10.15-alpine - -# COPY --from=builder /home/workspace/node_modules /home/theia/node_modules -# RUN rm -rf /home/theia/node_modules/@eclipse-che/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-remote -# COPY --from=builder /home/workspace/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext -# COPY --from=builder /home/workspace/packages/theia-remote/lib /home/theia/lib -# RUN mkdir /projects \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# opensuse/leap because opensuse depracated -# FROM opensuse/leap - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM cirros - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM clefos - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM mageia:7 - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM photon:latest - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - - -# FROM photon:latest - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# # alt os -# FROM alt - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - - -# FROM amazonlinux - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM open-liberty - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# ENTRYPOINT [ "/plugin-remote" ] - -# FROM php - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM oraclelinux - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] - -# FROM golang:stretch - -# COPY --from=builder /home/workspace/plugin-remote /plugin-remote - -# RUN mkdir /projects /home/theia \ -# # Store passwd/group as template files -# && cat /etc/passwd | sed s#root:x.*#root:x:\${USER_ID}:\${GROUP_ID}::\${HOME}:/bin/sh#g > ${HOME}/passwd.template \ -# && cat /etc/group | sed s#root:x:0:#root:x:0:0,\${USER_ID}:#g > ${HOME}/group.template \ -# # Change permissions to let any arbitrary user -# && for f in "${HOME}" "/etc/passwd" "/etc/group" "/projects"; do \ -# echo "Changing permissions on ${f}" && chgrp -R 0 ${f} && \ -# chmod -R g+rwX ${f}; \ -# done - -# ADD etc/entrypoint.sh /entrypoint.sh -# ENTRYPOINT ["/entrypoint.sh"] diff --git a/dockerfiles/theia-endpoint-runtime/build.sh b/dockerfiles/theia-endpoint-runtime/build.sh index 08a4a683f..cf2882fd4 100755 --- a/dockerfiles/theia-endpoint-runtime/build.sh +++ b/dockerfiles/theia-endpoint-runtime/build.sh @@ -44,5 +44,3 @@ cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/tsconfig.jso init --name:theia-endpoint-runtime "$@" build - -./retag.sh diff --git a/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh b/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh index f8fd0f2ab..1f85f5768 100755 --- a/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh +++ b/dockerfiles/theia-endpoint-runtime/etc/entrypoint.sh @@ -38,7 +38,7 @@ fi responsible_shutdown() { echo "" echo "Received SIGTERM" - kill -INT ${PID} + kill -SIGINT ${PID} wait ${PID} exit; } @@ -47,12 +47,12 @@ set -e # setup handlers # on callback, kill the last background process, which is `tail -f /dev/null` and execute the specified handler -trap 'responsible_shutdown' HUP TERM INT +trap 'responsible_shutdown' SIGHUP SIGTERM SIGINT cd ${HOME} # run theia endpoint -/plugin-remote & +node /home/theia/lib/node/plugin-remote.js & PID=$! From 09a8c150f4236c9b9cfcbc461a3b711586f10c5c Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Sun, 9 Jun 2019 13:34:49 +0300 Subject: [PATCH 4/6] Fix image name in the build script. Code clean up. Signed-off-by: Oleksandr Andriienko --- dockerfiles/theia-endpoint-runtime-binary/build.sh | 4 +--- dockerfiles/theia-endpoint-runtime-binary/push.sh | 3 --- dockerfiles/theia-endpoint-runtime-binary/retag.sh | 3 --- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100755 dockerfiles/theia-endpoint-runtime-binary/push.sh delete mode 100755 dockerfiles/theia-endpoint-runtime-binary/retag.sh diff --git a/dockerfiles/theia-endpoint-runtime-binary/build.sh b/dockerfiles/theia-endpoint-runtime-binary/build.sh index 08a4a683f..ea26bf98b 100755 --- a/dockerfiles/theia-endpoint-runtime-binary/build.sh +++ b/dockerfiles/theia-endpoint-runtime-binary/build.sh @@ -42,7 +42,5 @@ cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/package.json cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" -init --name:theia-endpoint-runtime "$@" +init --name:theia-endpoint-runtime-binary "$@" build - -./retag.sh diff --git a/dockerfiles/theia-endpoint-runtime-binary/push.sh b/dockerfiles/theia-endpoint-runtime-binary/push.sh deleted file mode 100755 index a7578b7f9..000000000 --- a/dockerfiles/theia-endpoint-runtime-binary/push.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker push aandrienko/che-theia-remote:next \ No newline at end of file diff --git a/dockerfiles/theia-endpoint-runtime-binary/retag.sh b/dockerfiles/theia-endpoint-runtime-binary/retag.sh deleted file mode 100755 index 0e750fac4..000000000 --- a/dockerfiles/theia-endpoint-runtime-binary/retag.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -docker tag eclipse/che-theia-endpoint-runtime:nightly aandrienko/che-theia-remote:next From 59f31412e0badee3f79f32748d80524f149ec186 Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Sun, 9 Jun 2019 13:46:31 +0300 Subject: [PATCH 5/6] Clean up. Signed-off-by: Oleksandr Andriienko --- che-theia-init-sources.yml | 2 +- dockerfiles/build.include | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/che-theia-init-sources.yml b/che-theia-init-sources.yml index a08beeca7..989c818d6 100644 --- a/che-theia-init-sources.yml +++ b/che-theia-init-sources.yml @@ -17,4 +17,4 @@ sources: - plugins/ports-plugin - plugins/task-plugin - plugins/welcome-plugin - checkoutTo: remoteBinary + checkoutTo: master diff --git a/dockerfiles/build.include b/dockerfiles/build.include index 844c3f34e..32dca4054 100755 --- a/dockerfiles/build.include +++ b/dockerfiles/build.include @@ -139,7 +139,7 @@ build_image() { printf "${BOLD}Building Docker Image ${IMAGE_NAME} from $DIR directory with tag $TAG${NC}\n" # Replace macros in Dockerfiles cat ${DIR}/${DOCKERFILE} | sed s/\$\{BUILD_ORGANIZATION\}/${ORGANIZATION}/ | sed s/\$\{BUILD_PREFIX\}/${PREFIX}/ | sed s/\$\{BUILD_TAG\}/${TAG}/ | sed s/\$\{BUILD_PARENT_IMAGE\}/${PARENT_IMAGE}/ | sed s/\$\{GIT_BRANCH_NAME\}/${BRANCH}/ | sed s/\$\{GIT_REF\}/"${GIT_REF}"/ > ${DIR}/.Dockerfile - cd "${DIR}" && docker build -f ${DIR}/.Dockerfile --no-cache -t ${IMAGE_NAME} ${BUILD_ARGS} . + cd "${DIR}" && docker build -f ${DIR}/.Dockerfile -t ${IMAGE_NAME} ${BUILD_ARGS} . rm ${DIR}/.Dockerfile if [ $? -eq 0 ]; then printf "Build of ${BLUE}${IMAGE_NAME} ${GREEN}[OK]${NC}\n" From 9019ddb63e0a8a8543ccbac546983d6284986deb Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Tue, 11 Jun 2019 15:36:45 +0300 Subject: [PATCH 6/6] Address changes. Signed-off-by: Oleksandr Andriienko --- .../theia-endpoint-runtime-binary/Dockerfile | 2 +- .../theia-endpoint-runtime-binary/build.sh | 30 ++++++++++--------- dockerfiles/theia-endpoint-runtime/Dockerfile | 2 +- .../src/node/che-plugin-api-provider.ts | 1 - .../src/node/plugin-remote-backend-module.ts | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/dockerfiles/theia-endpoint-runtime-binary/Dockerfile b/dockerfiles/theia-endpoint-runtime-binary/Dockerfile index c95d24e1f..da3dbaece 100644 --- a/dockerfiles/theia-endpoint-runtime-binary/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime-binary/Dockerfile @@ -31,7 +31,7 @@ RUN if [ ! -z "${GITHUB_TOKEN-}" ]; then \ fi \ fi -#invalidate cashe +#invalidate cache ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/theia-ide/theia/git/refs/head /tmp/branch_info.json ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/eclipse/che-theia/git/refs/head /tmp/branch_info.json diff --git a/dockerfiles/theia-endpoint-runtime-binary/build.sh b/dockerfiles/theia-endpoint-runtime-binary/build.sh index ea26bf98b..b60a0bb7a 100755 --- a/dockerfiles/theia-endpoint-runtime-binary/build.sh +++ b/dockerfiles/theia-endpoint-runtime-binary/build.sh @@ -20,26 +20,28 @@ fi #in mac os 'cp' cannot create destination dir, so create it first mkdir ${LOCAL_ASSEMBLY_DIR} -echo "Copying ${base_dir}/../../extensions/eclipse-che-theia-plugin --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin" +app_root=${base_dir}/../.. + +echo "Copying ${app_root}/extensions/eclipse-che-theia-plugin --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin" mkdir ${LOCAL_ASSEMBLY_DIR}/theia-plugin -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin/src/" -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin/src/" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin" -echo "Copying ${base_dir}/../../extensions/eclipse-che-theia-plugin-ext --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +echo "Copying ${app_root}/extensions/eclipse-che-theia-plugin-ext --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" mkdir ${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext/src/" -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-ext/webpack.config.js" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-ext/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext/src/" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-ext/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-ext/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-ext/webpack.config.js" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-ext" -echo "Copying ${base_dir}/../../configs --> ${LOCAL_ASSEMBLY_DIR}/configs" -cp -r "${base_dir}/../../configs/." "${LOCAL_ASSEMBLY_DIR}/configs" +echo "Copying ${app_root}/configs --> ${LOCAL_ASSEMBLY_DIR}/configs" +cp -r "${app_root}/configs/." "${LOCAL_ASSEMBLY_DIR}/configs" -echo "Copying ${base_dir}/../../extensions/eclipse-che-theia-plugin-remote --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" +echo "Copying ${app_root}/extensions/eclipse-che-theia-plugin-remote --> ${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" mkdir ${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote/src/" -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" -cp -r "${base_dir}/../../extensions/eclipse-che-theia-plugin-remote/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-remote/src/." "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote/src/" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-remote/package.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" +cp -r "${app_root}/extensions/eclipse-che-theia-plugin-remote/tsconfig.json" "${LOCAL_ASSEMBLY_DIR}/theia-plugin-remote" init --name:theia-endpoint-runtime-binary "$@" diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 380b07908..b3f65b89e 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -31,7 +31,7 @@ RUN if [ ! -z "${GITHUB_TOKEN-}" ]; then \ fi \ fi -#invalidate cashe +#invalidate cache ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/theia-ide/theia/git/refs/head /tmp/branch_info.json ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/eclipse/che-theia/git/refs/head /tmp/branch_info.json diff --git a/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts b/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts index 4144d79c1..a026917d5 100644 --- a/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts +++ b/extensions/eclipse-che-theia-plugin-ext/src/node/che-plugin-api-provider.ts @@ -15,7 +15,6 @@ import { injectable } from 'inversify'; export class ChePluginApiProvider implements ExtPluginApiProvider { provideApi(): ExtPluginApi { - console.log('provide che plugin api!!!'); return { frontendExtApi: { initPath: '/che/api/che-api-worker-provider.js', diff --git a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts index 9af925528..233e50b87 100644 --- a/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts +++ b/extensions/eclipse-che-theia-plugin-remote/src/node/plugin-remote-backend-module.ts @@ -23,7 +23,7 @@ const localModule = ConnectionContainerModule.create(({ bind }) => { export default new ContainerModule(bind => { try { - // Force nexe to include theia-plugin-ext iside binary + // Force nexe to include theia-plugin-ext inside binary require('@eclipse-che/theia-plugin-ext/lib/node/che-plugin-api-provider.js'); } catch (err) { console.log('Unable to set up che theia plugin api: ', err);