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
@@ -15,6 +33,47 @@ ARG CODE_COMMIT
1533ARG CODE_QUALITY
1634ARG CODE_VERSION
1735
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+
1877RUN sudo mkdir -m 0755 -p /etc/apt/keyrings
1978RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
2079
@@ -37,11 +96,15 @@ RUN apt-get install -y pkg-config dbus xvfb libgtk-3-0 libxkbfile-dev libkrb5-de
3796 # Start dbus session
3897 && mkdir -p /var/run/dbus
3998
40- # ENV npm_config_arch=x64
99+ ENV npm_config_arch=x64
41100RUN mkdir -p .build \
42101 && npm config set registry "$NPM_REGISTRY" \
43102 && npm ci
44103
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+
45108# check that the provided codeVersion is the correct one for the given codeCommit
46109RUN commitVersion=$(cat package.json | jq -r .version) \
47110 && if [ "$commitVersion" != "$CODE_VERSION" ]; then echo "Code version mismatch: $commitVersion != $CODE_VERSION" ; exit 1; fi
0 commit comments