1
1
# Copyright (c) 2024 Gitpod GmbH. All rights reserved.
2
2
# Licensed under the GNU Affero General Public License (AGPL).
3
3
# See License.AGPL.txt in the project root for license information.
4
+ FROM gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64 as dependencies_builder
5
+
6
+ ENV TRIGGER_REBUILD 1
7
+
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/remote
17
+
18
+ RUN npm ci
19
+
4
20
FROM gitpod/openvscode-server-linux-build-agent:focal-x64 as code_builder
5
21
6
22
ENV TRIGGER_REBUILD 1
@@ -9,6 +25,7 @@ ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
9
25
ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1
10
26
ENV VSCODE_ARCH=x64
11
27
ENV NPM_REGISTRY=https://registry.npmjs.org
28
+ ENV NODE_VERSION=20
12
29
13
30
ARG CODE_COMMIT
14
31
ARG CODE_QUALITY
@@ -17,12 +34,7 @@ ARG CODE_VERSION
17
34
RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
18
35
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
19
36
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
37
+ RUN 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
38
RUN apt-get update && apt-get install -y nodejs
27
39
28
40
RUN mkdir /gp-code \
@@ -41,14 +53,15 @@ RUN apt-get install -y pkg-config dbus xvfb libgtk-3-0 libxkbfile-dev libkrb5-de
41
53
# Start dbus session
42
54
&& mkdir -p /var/run/dbus
43
55
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
56
+ ENV npm_config_arch=x64
48
57
RUN mkdir -p .build \
49
58
&& npm config set registry "$NPM_REGISTRY" \
50
59
&& npm ci
51
60
61
+ # copy remote dependencies build in dependencies_builder image
62
+ RUN rm -rf remote/node_modules/
63
+ COPY --from=dependencies_builder /gp-code/remote/node_modules/ /gp-code/remote/node_modules/
64
+
52
65
# check that the provided codeVersion is the correct one for the given codeCommit
53
66
RUN commitVersion=$(cat package.json | jq -r .version) \
54
67
&& if [ "$commitVersion" != "$CODE_VERSION" ]; then echo "Code version mismatch: $commitVersion != $CODE_VERSION" ; exit 1; fi
0 commit comments