Skip to content

Commit 61edf05

Browse files
committed
Fix build
1 parent 286e135 commit 61edf05

File tree

3 files changed

+139
-16
lines changed

3 files changed

+139
-16
lines changed

components/ide/code/BUILD.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ packages:
2525
- codeQuality
2626
- codeVersion
2727
config:
28-
dockerfile: leeway.Dockerfile
28+
dockerfile: leeway.nightly.Dockerfile
2929
metadata:
3030
helm-component: workspace.codeImage
3131
buildArgs:

components/ide/code/leeway.Dockerfile

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
11
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
22
# Licensed under the GNU Affero General Public License (AGPL).
33
# See License.AGPL.txt in the project root for license information.
4-
FROM gitpod/openvscode-server-linux-build-agent:focal-x64 as code_builder
4+
FROM gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64 as dependencies_builder
55

66
ENV TRIGGER_REBUILD 1
77

8+
ARG CODE_COMMIT
9+
10+
RUN mkdir /gp-code \
11+
&& cd /gp-code \
12+
&& git init \
13+
&& git remote add origin https://github.com/gitpod-io/openvscode-server \
14+
&& git fetch origin $CODE_COMMIT --depth=1 \
15+
&& git reset --hard FETCH_HEAD
16+
WORKDIR /gp-code
17+
18+
# Disable v8 cache used by yarn v1.x, refs https://github.com/nodejs/node/issues/51555
19+
ENV DISABLE_V8_COMPILE_CACHE=1
20+
21+
RUN yarn --cwd remote --frozen-lockfile --network-timeout 180000
22+
23+
FROM gitpod/openvscode-server-linux-build-agent:focal-x64 as code_builder
24+
825
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
926
ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1
1027
ENV VSCODE_ARCH=x64
11-
ENV NPM_REGISTRY=https://registry.npmjs.org
28+
ENV NPM_REGISTRY=https://registry.yarnpkg.com
1229

1330
ARG CODE_COMMIT
1431
ARG CODE_QUALITY
@@ -44,11 +61,15 @@ RUN apt-get install -y pkg-config dbus xvfb libgtk-3-0 libxkbfile-dev libkrb5-de
4461
# Disable v8 cache used by yarn v1.x, refs https://github.com/nodejs/node/issues/51555
4562
ENV DISABLE_V8_COMPILE_CACHE=1
4663

47-
# ENV npm_config_arch=x64
64+
ENV npm_config_arch=x64
4865
RUN mkdir -p .build \
49-
&& npm config set registry "$NPM_REGISTRY" \
50-
&& npm ci \
51-
&& npm run compile
66+
&& yarn config set registry "$NPM_REGISTRY" \
67+
&& yarn --cwd build --frozen-lockfile --check-files --network-timeout 180000 \
68+
&& yarn --frozen-lockfile --check-files --network-timeout 180000
69+
70+
# copy remote dependencies build in dependencies_builder image
71+
RUN rm -rf remote/node_modules/
72+
COPY --from=dependencies_builder /gp-code/remote/node_modules/ /gp-code/remote/node_modules/
5273

5374
# check that the provided codeVersion is the correct one for the given codeCommit
5475
RUN commitVersion=$(cat package.json | jq -r .version) \
@@ -70,18 +91,18 @@ RUN nameShort=$(jq --raw-output '.nameShort' product.json) && \
7091
mv product.json.tmp product.json && \
7192
jq '{quality,nameLong,nameShort}' product.json
7293

73-
RUN npm run gulp compile-build \
74-
&& npm run gulp extensions-ci \
75-
&& npm run gulp minify-vscode-reh \
76-
&& npm run gulp vscode-web-min-ci \
77-
&& npm run gulp vscode-reh-linux-x64-min-ci
94+
RUN yarn gulp compile-build \
95+
&& yarn gulp extensions-ci \
96+
&& yarn gulp minify-vscode-reh \
97+
&& yarn gulp vscode-web-min-ci \
98+
&& yarn gulp vscode-reh-linux-x64-min-ci
7899

79100
# config for first layer needed by blobserve
80101
# this custom urls will be then replaced by blobserve.
81102
# Check pkg/blobserve/blobserve.go, `inlineVars` method
82-
RUN cp /gp-code/out/vs/gitpod/browser/workbench/workbench.html /gp-code/index.html \
83-
&& cp /gp-code/out/vs/gitpod/browser/workbench/callback.html /gp-code/callback.html \
84-
&& sed -i -e "s/{{VERSION}}/$CODE_QUALITY-$CODE_COMMIT/g" /gp-code/index.html
103+
RUN cp /vscode-web/out/vs/gitpod/browser/workbench/workbench.html /vscode-web/index.html \
104+
&& cp /vscode-web/out/vs/gitpod/browser/workbench/callback.html /vscode-web/callback.html \
105+
&& sed -i -e "s/{{VERSION}}/$CODE_QUALITY-$CODE_COMMIT/g" /vscode-web/index.html
85106

86107
# cli config: alises to gitpod-code
87108
RUN cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/code \
@@ -93,7 +114,7 @@ RUN chmod -R ugo+w /vscode-reh-linux-x64/extensions
93114

94115
FROM scratch
95116
# copy static web resources in first layer to serve from blobserve
96-
COPY --from=code_builder --chown=33333:33333 /gp-code/ /ide/
117+
COPY --from=code_builder --chown=33333:33333 /vscode-web/ /ide/
97118
COPY --from=code_builder --chown=33333:33333 /vscode-reh-linux-x64/ /ide/
98119

99120
ARG CODE_VERSION
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Copyright (c) 2020 Gitpod GmbH. All rights reserved.
2+
# Licensed under the GNU Affero General Public License (AGPL).
3+
# See License.AGPL.txt in the project root for license information.
4+
FROM gitpod/openvscode-server-linux-build-agent:focal-x64 as code_builder
5+
6+
ENV TRIGGER_REBUILD 1
7+
8+
ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
9+
ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1
10+
ENV VSCODE_ARCH=x64
11+
ENV NPM_REGISTRY=https://registry.npmjs.org
12+
13+
ARG CODE_COMMIT
14+
ARG CODE_QUALITY
15+
ARG CODE_VERSION
16+
17+
RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
18+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
19+
20+
RUN if dpkg --compare-versions "$CODE_VERSION" "ge" "1.90"; then \
21+
NODE_VERSION=20; \
22+
else \
23+
NODE_VERSION=18; \
24+
fi && \
25+
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_VERSION.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
26+
RUN apt-get update && apt-get install -y nodejs
27+
28+
RUN mkdir /gp-code \
29+
&& cd /gp-code \
30+
&& git init \
31+
&& git remote add origin https://github.com/gitpod-io/openvscode-server \
32+
&& git fetch origin $CODE_COMMIT --depth=1 \
33+
&& git reset --hard FETCH_HEAD
34+
WORKDIR /gp-code
35+
36+
RUN apt-get install -y pkg-config dbus xvfb libgtk-3-0 libxkbfile-dev libkrb5-dev libgbm1 rpm \
37+
&& cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb \
38+
&& chmod +x /etc/init.d/xvfb \
39+
&& update-rc.d xvfb defaults \
40+
&& service xvfb start \
41+
# Start dbus session
42+
&& mkdir -p /var/run/dbus
43+
44+
# Disable v8 cache used by yarn v1.x, refs https://github.com/nodejs/node/issues/51555
45+
ENV DISABLE_V8_COMPILE_CACHE=1
46+
47+
# ENV npm_config_arch=x64
48+
RUN mkdir -p .build \
49+
&& npm config set registry "$NPM_REGISTRY" \
50+
&& npm ci \
51+
&& npm run compile
52+
53+
# check that the provided codeVersion is the correct one for the given codeCommit
54+
RUN commitVersion=$(cat package.json | jq -r .version) \
55+
&& if [ "$commitVersion" != "$CODE_VERSION" ]; then echo "Code version mismatch: $commitVersion != $CODE_VERSION"; exit 1; fi
56+
57+
# update product.json
58+
RUN nameShort=$(jq --raw-output '.nameShort' product.json) && \
59+
nameLong=$(jq --raw-output '.nameLong' product.json) && \
60+
if [ "$CODE_QUALITY" = "insider" ]; then \
61+
nameShort="$nameShort - Insiders" \
62+
nameLong="$nameLong - Insiders" \
63+
; fi && \
64+
setQuality="setpath([\"quality\"]; \"$CODE_QUALITY\")" && \
65+
setNameShort="setpath([\"nameShort\"]; \"$nameShort\")" && \
66+
setNameLong="setpath([\"nameLong\"]; \"$nameLong\")" && \
67+
setSegmentKey="setpath([\"segmentKey\"]; \"untrusted-dummy-key\")" && \
68+
jqCommands="${setQuality} | ${setNameShort} | ${setNameLong} | ${setSegmentKey}" && \
69+
cat product.json | jq "${jqCommands}" > product.json.tmp && \
70+
mv product.json.tmp product.json && \
71+
jq '{quality,nameLong,nameShort}' product.json
72+
73+
RUN npm run gulp compile-build \
74+
&& npm run gulp extensions-ci \
75+
&& npm run gulp minify-vscode-reh \
76+
&& npm run gulp vscode-web-min-ci \
77+
&& npm run gulp vscode-reh-linux-x64-min-ci
78+
79+
# config for first layer needed by blobserve
80+
# this custom urls will be then replaced by blobserve.
81+
# Check pkg/blobserve/blobserve.go, `inlineVars` method
82+
RUN cp /gp-code/out/vs/gitpod/browser/workbench/workbench.html /gp-code/index.html \
83+
&& cp /gp-code/out/vs/gitpod/browser/workbench/callback.html /gp-code/callback.html \
84+
&& sed -i -e "s/{{VERSION}}/$CODE_QUALITY-$CODE_COMMIT/g" /gp-code/index.html
85+
86+
# cli config: alises to gitpod-code
87+
RUN cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/code \
88+
&& cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/gp-code \
89+
&& cp /vscode-reh-linux-x64/bin/remote-cli/gitpod-code /vscode-reh-linux-x64/bin/remote-cli/open
90+
91+
# grant write permissions for built-in extensions
92+
RUN chmod -R ugo+w /vscode-reh-linux-x64/extensions
93+
94+
FROM scratch
95+
# copy static web resources in first layer to serve from blobserve
96+
COPY --from=code_builder --chown=33333:33333 /gp-code/ /ide/
97+
COPY --from=code_builder --chown=33333:33333 /vscode-reh-linux-x64/ /ide/
98+
99+
ARG CODE_VERSION
100+
ARG CODE_COMMIT
101+
LABEL "io.gitpod.ide.version"=$CODE_VERSION
102+
LABEL "io.gitpod.ide.commit"=$CODE_COMMIT

0 commit comments

Comments
 (0)