From 5d89588193c759ad496e27b8f1521b4abc689f41 Mon Sep 17 00:00:00 2001 From: Yevhen Vydolob Date: Mon, 12 Aug 2019 11:34:19 +0300 Subject: [PATCH 1/4] eclipse/che#14187 use same version of @theia dependencies in 'che-theia' and 'che-theia-endpoint-runtime' images Signed-off-by: Yevhen Vydolob --- docker_image_build.include | 2 ++ dockerfiles/theia-endpoint-runtime/Dockerfile | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docker_image_build.include b/docker_image_build.include index 61015b893..f1bf900ce 100644 --- a/docker_image_build.include +++ b/docker_image_build.include @@ -67,6 +67,8 @@ buildImages() { bash $(pwd)/$image_dir/build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=${THEIA_VERSION} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} --git-ref:${THEIA_GIT_REFS} elif [ "$image_dir" == "dockerfiles/theia-dev" ]; then bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} + elif [ "$image_dir" == "dockerfiles/theia-endpoint-runtime"]; then + bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} else bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} fi diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index e5d84d867..6c7fdc494 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -15,6 +15,8 @@ FROM ${BUILD_ORGANIZATION}/${BUILD_PREFIX}-theia-dev:${BUILD_TAG} as builder # else check if github rate limit is enough, else will abort requiring to set GITHUB_TOKEN value ARG GITHUB_TOKEN +ARG THEIA_GITHUB_REPO=theia-ide/theia + # Check github limit RUN if [ ! -z "${GITHUB_TOKEN-}" ]; then \ export GITHUB_TOKEN=$GITHUB_TOKEN; \ @@ -35,11 +37,16 @@ RUN if [ ! -z "${GITHUB_TOKEN-}" ]; then \ 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 +# Clone theia +RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch --depth 1 https://github.com/${THEIA_GITHUB_REPO} ${HOME}/theia-source-code +# Compile Theia +RUN cd ${HOME}/theia-source-code && yarn + # 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 +# Adding sources 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 @@ -48,7 +55,12 @@ 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 +# installing all dependencies +RUN cd /home/workspace/ && yarn install --ignore-scripts +# remove all @theia/* modules, and replace tham from builded Theia branch version +RUN rm -rf /home/workspace/node_modules/@theia && cp -r -L ${HOME}/theia-source-code/node_modules/@theia /home/workspace/node_modules/ +# Compile +RUN cd /home/workspace/ && yarn prepare FROM node:10.16-alpine ENV HOME=/home/theia From 8544cbad60593b8938d8dade760c99deaebd0c5a Mon Sep 17 00:00:00 2001 From: Yevhen Vydolob Date: Tue, 13 Aug 2019 10:48:59 +0300 Subject: [PATCH 2/4] Rework build, use 'che:theia production' command Signed-off-by: Yevhen Vydolob --- docker_image_build.include | 2 +- dockerfiles/theia-endpoint-runtime/Dockerfile | 40 +++++++++---------- .../package.json | 2 +- .../src/node/terminal-container-aware.ts | 5 ++- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/docker_image_build.include b/docker_image_build.include index f1bf900ce..b2d3904b2 100644 --- a/docker_image_build.include +++ b/docker_image_build.include @@ -67,7 +67,7 @@ buildImages() { bash $(pwd)/$image_dir/build.sh --build-args:${GITHUB_TOKEN_ARG},THEIA_VERSION=${THEIA_VERSION} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} --git-ref:${THEIA_GIT_REFS} elif [ "$image_dir" == "dockerfiles/theia-dev" ]; then bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} - elif [ "$image_dir" == "dockerfiles/theia-endpoint-runtime"]; then + elif [ "$image_dir" == "dockerfiles/theia-endpoint-runtime" ]; then bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} --branch:${THEIA_BRANCH} else bash $(pwd)/$image_dir/build.sh --build-arg:${GITHUB_TOKEN_ARG} --tag:${IMAGE_TAG} diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 6c7fdc494..0edd7fd90 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -38,36 +38,36 @@ ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/theia-ide/theia/g ADD https://${GITHUB_TOKEN}:x-oauth-basic@api.github.com/repos/eclipse/che-theia/git/refs/head /tmp/branch_info.json # Clone theia -RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch --depth 1 https://github.com/${THEIA_GITHUB_REPO} ${HOME}/theia-source-code -# Compile Theia -RUN cd ${HOME}/theia-source-code && yarn +RUN git clone --branch ${GIT_BRANCH_NAME} --single-branch --depth 1 https://github.com/${THEIA_GITHUB_REPO} /home/workspace # 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 +COPY /docker-build/theia-plugin-remote/package.json /home/workspace/examples/assembly/ +RUN cd /home/workspace/examples/assembly/ && yarn install --ignore-scripts # Adding sources -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 /docker-build/configs /home/workspace/che/configs +COPY /docker-build/configs/tsfmt.json /home/workspace/configs/tsfmt.json +COPY /docker-build/configs/tslint.json /home/workspace/configs/tslint.json +COPY /docker-build/theia-plugin-remote/*.json /home/workspace/examples/assembly/ +COPY /docker-build/theia-plugin-remote/src /home/workspace/examples/assembly/src +COPY /docker-build/theia-plugin-ext /home/workspace/che/packages/theia-plugin-ext +COPY /docker-build/theia-plugin /home/workspace/che/packages/theia-plugin + +RUN ln -s /home/workspace/che/packages/theia-plugin-ext /home/workspace/packages/theia-plugin-ext +RUN ln -s /home/workspace/che/packages/theia-plugin /home/workspace/packages/theia-plugin -COPY /etc/package.json /home/workspace # installing all dependencies -RUN cd /home/workspace/ && yarn install --ignore-scripts -# remove all @theia/* modules, and replace tham from builded Theia branch version -RUN rm -rf /home/workspace/node_modules/@theia && cp -r -L ${HOME}/theia-source-code/node_modules/@theia /home/workspace/node_modules/ -# Compile -RUN cd /home/workspace/ && yarn prepare +RUN cd /home/workspace/ && yarn + +# Run into production mode +RUN cd /home/workspace/ && che:theia production FROM node:10.16-alpine ENV HOME=/home/theia -COPY --from=builder /home/workspace/node_modules /home/theia/node_modules +COPY --from=builder /home/workspace/production /home/theia/ 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 +COPY --from=builder /home/workspace/che/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext +COPY --from=builder /home/workspace/production/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 \ diff --git a/extensions/eclipse-che-theia-plugin-remote/package.json b/extensions/eclipse-che-theia-plugin-remote/package.json index 47437f37e..40f4280d1 100644 --- a/extensions/eclipse-che-theia-plugin-remote/package.json +++ b/extensions/eclipse-che-theia-plugin-remote/package.json @@ -1,5 +1,5 @@ { - "name": "@eclipse-che/theia-remote", + "name": "@eclipse-che/theia-assembly", "author": "Florent Benoit", "version": "0.0.1", "license": "EPL-2.0", diff --git a/extensions/eclipse-che-theia-plugin-remote/src/node/terminal-container-aware.ts b/extensions/eclipse-che-theia-plugin-remote/src/node/terminal-container-aware.ts index 1044a162b..971fcd432 100644 --- a/extensions/eclipse-che-theia-plugin-remote/src/node/terminal-container-aware.ts +++ b/extensions/eclipse-che-theia-plugin-remote/src/node/terminal-container-aware.ts @@ -11,6 +11,7 @@ import * as theia from '@theia/plugin'; import { TerminalServiceExtImpl } from '@theia/plugin-ext/lib/plugin/terminal-ext'; import { DebugExtImpl } from '@theia/plugin-ext/lib/plugin/node/debug/debug'; +import { TerminalOptionsExt } from '@theia/plugin-ext/lib/api/plugin-api'; /** * Allow to override createTerminal to be container-aware and then create terminal to the sidecar container @@ -54,9 +55,9 @@ export class TerminalContainerAware { overrideTerminalCreationOptionForDebug(debugExt: DebugExtImpl) { debugExt.doGetTerminalCreationOptions = (debugType: string) => { - const options: theia.TerminalOptions = { + const options: TerminalOptionsExt = { attributes: { - 'CHE_MACHINE_NAME': process.env.CHE_MACHINE_NAME + 'CHE_MACHINE_NAME': process.env.CHE_MACHINE_NAME! } }; From 1afae20d313b8a6220c5765ca15f0ac1beca1f60 Mon Sep 17 00:00:00 2001 From: Yevhen Vydolob Date: Tue, 13 Aug 2019 11:45:49 +0300 Subject: [PATCH 3/4] Remove unnecessary copy Signed-off-by: Yevhen Vydolob --- dockerfiles/theia-endpoint-runtime/Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 0edd7fd90..911d48ca3 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -65,9 +65,6 @@ RUN cd /home/workspace/ && che:theia production FROM node:10.16-alpine ENV HOME=/home/theia COPY --from=builder /home/workspace/production /home/theia/ -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/che/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext -COPY --from=builder /home/workspace/production/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 \ From c60fe6524d9678d9c9530c7353ef2ba7868ec19d Mon Sep 17 00:00:00 2001 From: Yevhen Vydolob Date: Tue, 13 Aug 2019 17:38:31 +0300 Subject: [PATCH 4/4] fix 'Cannot find module @eclipse-che/theia-plugin-ext' error Signed-off-by: Yevhen Vydolob --- dockerfiles/theia-endpoint-runtime/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/dockerfiles/theia-endpoint-runtime/Dockerfile b/dockerfiles/theia-endpoint-runtime/Dockerfile index 911d48ca3..ce59fb316 100644 --- a/dockerfiles/theia-endpoint-runtime/Dockerfile +++ b/dockerfiles/theia-endpoint-runtime/Dockerfile @@ -65,6 +65,7 @@ RUN cd /home/workspace/ && che:theia production FROM node:10.16-alpine ENV HOME=/home/theia COPY --from=builder /home/workspace/production /home/theia/ +COPY --from=builder /home/workspace/che/packages/theia-plugin-ext /home/theia/node_modules/@eclipse-che/theia-plugin-ext 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 \