From 736eed7cfeb078e6d30fac1d2d9af4aaf327cf16 Mon Sep 17 00:00:00 2001 From: Jean Pierre Date: Fri, 4 Feb 2022 21:08:35 +0000 Subject: [PATCH] Build code dependencies separately --- WORKSPACE.yaml | 2 +- components/ide/code/BUILD.yaml | 16 +--------- components/ide/code/base.Dockerfile | 26 ----------------- components/ide/code/leeway.Dockerfile | 42 +++++++++++++++++++++------ 4 files changed, 35 insertions(+), 51 deletions(-) delete mode 100644 components/ide/code/base.Dockerfile diff --git a/WORKSPACE.yaml b/WORKSPACE.yaml index 5317b690c47a8d..523392ce5dd940 100644 --- a/WORKSPACE.yaml +++ b/WORKSPACE.yaml @@ -7,7 +7,7 @@ defaultArgs: jbMarketplacePublishTrigger: "false" publishToJBMarketplace: true localAppVersion: unknown - codeCommit: 4035f15a03e6d92cb9815e366b856e43f1caabe7 + codeCommit: 543d66ff57b0b01f48d6f66fc2fa2fc64d26a848 intellijDownloadUrl: "https://download.jetbrains.com/idea/ideaIU-2021.3.2.tar.gz" golandDownloadUrl: "https://download.jetbrains.com/go/goland-2021.3.3.tar.gz" pycharmDownloadUrl: "https://download.jetbrains.com/python/pycharm-professional-2021.3.2.tar.gz" diff --git a/components/ide/code/BUILD.yaml b/components/ide/code/BUILD.yaml index 47c79ac5cc9d0e..f0371c92b946a0 100644 --- a/components/ide/code/BUILD.yaml +++ b/components/ide/code/BUILD.yaml @@ -1,8 +1,6 @@ packages: - name: docker type: docker - deps: - - :docker-base srcs: - "startup.sh" - "supervisor-ide-config.json" @@ -10,8 +8,6 @@ packages: argdeps: - imageRepoBase - codeCommit - prep: - - ["sh", "-c", "sed -i -e 's#BUILDER_BASE#'$(cat components-ide-code--docker-base/imgnames.txt)'#g' Dockerfile"] config: dockerfile: leeway.Dockerfile metadata: @@ -20,14 +16,4 @@ packages: CODE_COMMIT: ${codeCommit} image: - ${imageRepoBase}/ide/code:${version} - - ${imageRepoBase}/ide/code:commit-${__git_commit} - - name: docker-base - type: docker - argdeps: - - imageRepoBase - config: - dockerfile: base.Dockerfile - metadata: - helm-component: workspace.codeImage - image: - - ${imageRepoBase}/ide/code-base:commit-${__git_commit} + - ${imageRepoBase}/ide/code:commit-${__git_commit} \ No newline at end of file diff --git a/components/ide/code/base.Dockerfile b/components/ide/code/base.Dockerfile deleted file mode 100644 index c74d3fe9824529..00000000000000 --- a/components/ide/code/base.Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (c) 2020 Gitpod GmbH. All rights reserved. -# Licensed under the GNU Affero General Public License (AGPL). -# See License-AGPL.txt in the project root for license information. - -FROM ubuntu:18.04 - -# we use latest major version of Node.js distributed VS Code. (see about dialog in your local VS Code) -# ideallay we should use exact version, but it has criticla bugs in regards to grpc over http2 streams -ARG NODE_VERSION=14.18.2 - -RUN apt-get update \ - # see https://github.com/microsoft/vscode/blob/42e271dd2e7c8f320f991034b62d4c703afb3e28/.github/workflows/ci.yml#L94 - && apt-get -y install --no-install-recommends libxkbfile-dev pkg-config libsecret-1-dev libxss1 dbus xvfb libgtk-3-0 libgbm1 \ - && apt-get -y install --no-install-recommends git curl build-essential libssl-dev ca-certificates python \ - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* - -ENV NVM_DIR /root/.nvm -RUN curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | sh \ - && . $NVM_DIR/nvm.sh \ - && nvm install $NODE_VERSION \ - && nvm alias default $NODE_VERSION \ - && npm install -g yarn node-gyp -ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH diff --git a/components/ide/code/leeway.Dockerfile b/components/ide/code/leeway.Dockerfile index 4afec0a72f9e0b..879d304a7b5e3d 100644 --- a/components/ide/code/leeway.Dockerfile +++ b/components/ide/code/leeway.Dockerfile @@ -2,26 +2,50 @@ # Licensed under the GNU Affero General Public License (AGPL). # See License-AGPL.txt in the project root for license information. -# BUILDER_BASE is a placeholder, will be replaced before build time -# Check BUILD.yaml -FROM BUILDER_BASE as code_installer +FROM gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64 as dependencies_builder ARG CODE_COMMIT +RUN mkdir /gp-code \ + && cd /gp-code \ + && git init \ + && git remote add origin https://github.com/gitpod-io/vscode \ + && git fetch origin $CODE_COMMIT --depth=1 \ + && git reset --hard FETCH_HEAD +WORKDIR /gp-code +RUN yarn --cwd remote --frozen-lockfile --network-timeout 180000 + + +FROM gitpod/openvscode-server-linux-build-agent:bionic-x64 as code_installer + +USER root + +ARG CODE_COMMIT + +ARG NODE_VERSION=14.18.2 +ARG NVM_DIR="/root/.nvm" +RUN mkdir -p $NVM_DIR \ + && curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | sh \ + && . $NVM_DIR/nvm.sh \ + && nvm alias default $NODE_VERSION +ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH + ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD 1 ENV ELECTRON_SKIP_BINARY_DOWNLOAD 1 -RUN mkdir gp-code \ - && cd gp-code \ +RUN mkdir /gp-code \ + && cd /gp-code \ && git init \ && git remote add origin https://github.com/gitpod-io/vscode \ && git fetch origin $CODE_COMMIT --depth=1 \ && git reset --hard FETCH_HEAD WORKDIR /gp-code -RUN yarn --frozen-lockfile --network-timeout 180000 -RUN yarn --cwd ./extensions compile -RUN yarn gulp vscode-web-min -RUN yarn gulp vscode-reh-linux-x64-min +RUN yarn --frozen-lockfile --network-timeout 180000 \ + && yarn --cwd remote/web --frozen-lockfile --network-timeout 180000 \ + && yarn --cwd extensions compile \ + && yarn gulp vscode-web-min \ + && yarn gulp vscode-reh-linux-x64-min +COPY --from=dependencies_builder /gp-code/remote/node_modules/ /vscode-reh-linux-x64/node_modules/ # config for first layer needed by blobserve # we also remove `static/` from resource urls as that's needed by blobserve,