Skip to content

Commit 6a9e59c

Browse files
author
Ayane Satomi
authored
Merge branch 'master' into sr229/travis-arm
2 parents 21230b3 + 7f07b8f commit 6a9e59c

File tree

5 files changed

+91
-26
lines changed

5 files changed

+91
-26
lines changed

.travis.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ before_install:
88
- export MAJOR_VERSION="2"
99
- export VSCODE_VERSION="1.39.2"
1010
- export VERSION="$MAJOR_VERSION.$TRAVIS_BUILD_NUMBER"
11-
- export TAG="$VERSION-vsc$VSCODE_VERSION-$(uname -m)"
11+
- export TAG="$VERSION-vsc$VSCODE_VERSION"
1212
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export MINIFY="true"; fi
1313
- if [[ "$TRAVIS_BRANCH" == "master" ]]; then export PACKAGE="true"; fi
1414

@@ -19,7 +19,7 @@ jobs:
1919
os: linux
2020
arch: amd64
2121
dist: trusty
22-
env: TARGET="linux"
22+
env: TARGET="linux" PUSH_DOCKER="true"
2323
if: tag IS blank
2424
script: scripts/ci.bash
2525
- name: "Alpine build - x86_64"
@@ -70,7 +70,7 @@ before_deploy:
7070
- git config --local user.name "$USER_NAME"
7171
- git config --local user.email "$USER_EMAIL"
7272
- if ! git tag "$TAG" "$TRAVIS_COMMIT" ; then echo "$TAG already exists"; fi
73-
- if [[ -n "$DOCKER_BUILD" ]] ; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin ; fi
73+
- if [[ -n "$PUSH_DOCKER" ]] ; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin ; fi
7474

7575
deploy:
7676
- provider: releases
@@ -91,11 +91,11 @@ deploy:
9191

9292
- provider: script
9393
skip_cleanup: true
94-
script: docker push codercom/code-server:"$TAG" ; docker push codercom/code-server:v2
94+
script: docker build -f ./scripts/ci.dockerfile --build-arg -t codercom/code-server:"$TAG" -t codercom/code-server:v2 . && docker push codercom/code-server:"$TAG" && docker push codercom/code-server:v2
9595
on:
9696
repo: cdr/code-server
9797
branch: master
98-
condition: -n "$DOCKER_BUILD"
98+
condition: -n "$PUSH_DOCKER"
9999

100100
cache:
101101
yarn: true

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ arguments when launching code-server with Docker. See
5858

5959
### Build
6060

61+
See
62+
[VS Code prerequisites](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites)
63+
before building.
64+
6165
```shell
6266
export OUT=/path/to/output/build # Optional if only building. Required if also developing.
6367
yarn build ${vscodeVersion} ${codeServerVersion} # See travis.yml for the VS Code version to use.
@@ -102,6 +106,10 @@ data collected to improve code-server.
102106

103107
### Development
104108

109+
See
110+
[VS Code prerequisites](https://github.com/Microsoft/vscode/wiki/How-to-Contribute#prerequisites)
111+
before developing.
112+
105113
```shell
106114
git clone https://github.com/microsoft/vscode
107115
cd vscode

scripts/build.ts

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,21 +158,28 @@ class Builder {
158158
});
159159

160160
// Download and prepare VS Code if necessary (should be cached by CI).
161-
const exists = fs.existsSync(vscodeSourcePath);
162-
if (exists) {
163-
this.log("Using existing VS Code directory");
161+
if (fs.existsSync(vscodeSourcePath)) {
162+
this.log("Using existing VS Code clone");
164163
} else {
165164
await this.task("Cloning VS Code", () => {
166165
return util.promisify(cp.exec)(
167166
"git clone https://github.com/microsoft/vscode"
168167
+ ` --quiet --branch "${vscodeVersion}"`
169168
+ ` --single-branch --depth=1 "${vscodeSourcePath}"`);
170169
});
170+
}
171171

172+
if (fs.existsSync(path.join(vscodeSourcePath, "node_modules"))) {
173+
this.log("Using existing VS Code node_modules");
174+
} else {
172175
await this.task("Installing VS Code dependencies", () => {
173176
return util.promisify(cp.exec)("yarn", { cwd: vscodeSourcePath });
174177
});
178+
}
175179

180+
if (fs.existsSync(path.join(vscodeSourcePath, ".build/extensions"))) {
181+
this.log("Using existing built-in-extensions");
182+
} else {
176183
await this.task("Building default extensions", () => {
177184
return util.promisify(cp.exec)(
178185
"yarn gulp compile-extensions-build --max-old-space-size=32384",
@@ -296,8 +303,16 @@ class Builder {
296303
]);
297304
});
298305

299-
// This is so it doesn't get cached along with VS Code (no point).
300-
await this.task("Removing copied server", () => fs.remove(serverPath));
306+
// This is so it doesn't get cached along with VS Code. There's no point
307+
// since there isn't anything like an incremental build.
308+
await this.task("Removing build files for smaller cache", () => {
309+
return Promise.all([
310+
fs.remove(serverPath),
311+
fs.remove(path.join(vscodeSourcePath, "out-vscode")),
312+
fs.remove(path.join(vscodeSourcePath, "out-vscode-min")),
313+
fs.remove(path.join(vscodeSourcePath, "out-build")),
314+
]);
315+
});
301316

302317
// Prepend code to the target which enables finding files within the binary.
303318
const prependLoader = async (relativeFilePath: string): Promise<void> => {
@@ -326,19 +341,25 @@ class Builder {
326341
]);
327342
});
328343

329-
// TODO: fix onigasm dep
330-
// # onigasm 2.2.2 has a bug that makes it broken for PHP files so use 2.2.1.
331-
// # https://github.com/NeekSandhu/onigasm/issues/17
332-
// function fix-onigasm() {
333-
// local onigasmPath="${buildPath}/node_modules/onigasm-umd"
334-
// rm -rf "${onigasmPath}"
335-
// git clone "https://github.com/alexandrudima/onigasm-umd" "${onigasmPath}"
336-
// cd "${onigasmPath}" && yarn && yarn add --dev [email protected] && yarn package
337-
// mkdir "${onigasmPath}-temp"
338-
// mv "${onigasmPath}/"{release,LICENSE} "${onigasmPath}-temp"
339-
// rm -rf "${onigasmPath}"
340-
// mv "${onigasmPath}-temp" "${onigasmPath}"
341-
// }
344+
// onigasm 2.2.2 has a bug that makes it broken for PHP files so use 2.2.1.
345+
// https://github.com/NeekSandhu/onigasm/issues/17
346+
await this.task("Applying onigasm PHP fix", async () => {
347+
const onigasmPath = path.join(finalBuildPath, "node_modules/onigasm-umd");
348+
const onigasmTmpPath = `${onigasmPath}-temp`;
349+
await Promise.all([
350+
fs.remove(onigasmPath),
351+
fs.mkdir(onigasmTmpPath),
352+
]);
353+
await util.promisify(cp.exec)(`git clone "https://github.com/alexandrudima/onigasm-umd" "${onigasmPath}"`);
354+
await util.promisify(cp.exec)("yarn", { cwd: onigasmPath });
355+
await util.promisify(cp.exec)("yarn add --dev [email protected]", { cwd: onigasmPath });
356+
await util.promisify(cp.exec)("yarn package", { cwd: onigasmPath });
357+
await Promise.all(["release", "LICENSE", "package.json"].map((fileName) => {
358+
return fs.copy(path.join(onigasmPath, fileName), path.join(onigasmTmpPath, fileName));
359+
}));
360+
await fs.remove(onigasmPath);
361+
await fs.move(onigasmTmpPath, onigasmPath);
362+
});
342363

343364
this.log(`Final build: ${finalBuildPath}`);
344365
}

scripts/ci.dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# We deploy with ubuntu so that devs have a familiar environment.
2+
FROM ubuntu:18.04
3+
4+
RUN apt-get update && apt-get install -y \
5+
openssl \
6+
net-tools \
7+
git \
8+
locales \
9+
sudo \
10+
dumb-init \
11+
vim \
12+
curl \
13+
wget
14+
15+
RUN locale-gen en_US.UTF-8
16+
# We cannot use update-locale because docker will not use the env variables
17+
# configured in /etc/default/locale so we need to set it manually.
18+
ENV LC_ALL=en_US.UTF-8
19+
20+
RUN adduser --gecos '' --disabled-password coder && \
21+
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
22+
23+
USER coder
24+
# We create first instead of just using WORKDIR as when WORKDIR creates, the
25+
# user is root.
26+
RUN mkdir -p /home/coder/project
27+
28+
WORKDIR /home/coder/project
29+
30+
# This ensures we have a volume mounted even if the user forgot to do bind
31+
# mount. So that they do not lose their data if they delete the container.
32+
VOLUME [ "/home/coder/project" ]
33+
34+
COPY ./binaries/code-server* /usr/local/bin/code-server
35+
EXPOSE 8080
36+
37+
ENTRYPOINT ["dumb-init", "code-server", "--host", "0.0.0.0"]

scripts/optimize.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@ const vscodeResources = [
2323
"out-build/vs/server/main.js",
2424
"out-build/vs/server/src/node/uriTransformer.js",
2525
"!out-build/vs/server/doc/**",
26-
"out-build/vs/code/browser/workbench/**",
27-
"out-build/vs/server/src/browser/*.html",
2826
"out-build/vs/server/src/media/*",
2927
"out-build/vs/workbench/services/extensions/worker/extensionHostWorkerMain.js",
3028
"out-build/bootstrap.js",
3129
"out-build/bootstrap-fork.js",
3230
"out-build/bootstrap-amd.js",
3331
"out-build/paths.js",
34-
"out-build/vs/**/*.{svg,png}",
32+
'out-build/vs/**/*.{svg,png,html}',
33+
"!out-build/vs/code/browser/workbench/*.html",
3534
'!out-build/vs/code/electron-browser/**',
3635
"out-build/vs/base/common/performance.js",
3736
"out-build/vs/base/node/languagePacks.js",

0 commit comments

Comments
 (0)