1- # Copyright (c) 2020 Gitpod GmbH. All rights reserved.
1+ # Copyright (c) 2024 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
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+
20+ FROM ubuntu:22.04 as code_builder
21+
22+ ARG DEBIAN_FRONTEND=noninteractive
523
624ENV TRIGGER_REBUILD 1
725
826ENV PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1
927ENV ELECTRON_SKIP_BINARY_DOWNLOAD=1
1028ENV VSCODE_ARCH=x64
1129ENV NPM_REGISTRY=https://registry.npmjs.org
30+ ENV NODE_VERSION=20
1231
1332ARG CODE_COMMIT
1433ARG CODE_QUALITY
1534ARG CODE_VERSION
1635
36+ # Latest stable git
37+ RUN apt-get update && apt-get install -y software-properties-common
38+ RUN add-apt-repository ppa:git-core/ppa -y
39+
40+ RUN apt-get update && apt-get install -y \
41+ apt-transport-https \
42+ ca-certificates \
43+ curl \
44+ file \
45+ git \
46+ gnome-keyring \
47+ iproute2 \
48+ libfuse2 \
49+ libgconf-2-4 \
50+ libgdk-pixbuf2.0-0 \
51+ libgl1 \
52+ libgtk-3.0 \
53+ libsecret-1-dev \
54+ libssl-dev \
55+ libx11-dev \
56+ libx11-xcb-dev \
57+ libxkbfile-dev \
58+ locales \
59+ lsb-release \
60+ lsof \
61+ python3-pip \
62+ sudo \
63+ wget \
64+ xvfb \
65+ tzdata \
66+ unzip \
67+ jq
68+
69+ # Set python3 as default
70+ RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
71+ RUN python --version
72+
73+ # Check compiler toolchain
74+ RUN gcc --version
75+ RUN g++ --version
76+
1777RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
1878RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
1979
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
80+ 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
2681RUN apt-get update && apt-get install -y nodejs
2782
2883RUN mkdir /gp-code \
@@ -41,14 +96,15 @@ RUN apt-get install -y pkg-config dbus xvfb libgtk-3-0 libxkbfile-dev libkrb5-de
4196 # Start dbus session
4297 && mkdir -p /var/run/dbus
4398
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
99+ ENV npm_config_arch=x64
48100RUN mkdir -p .build \
49101 && npm config set registry "$NPM_REGISTRY" \
50102 && npm ci
51103
104+ # copy remote dependencies build in dependencies_builder image
105+ RUN rm -rf remote/node_modules/
106+ COPY --from=dependencies_builder /gp-code/remote/node_modules/ /gp-code/remote/node_modules/
107+
52108# check that the provided codeVersion is the correct one for the given codeCommit
53109RUN commitVersion=$(cat package.json | jq -r .version) \
54110 && if [ "$commitVersion" != "$CODE_VERSION" ]; then echo "Code version mismatch: $commitVersion != $CODE_VERSION" ; exit 1; fi
0 commit comments