未验证 提交 db39eacf 编写于 作者: A Asher 提交者: GitHub

Set NODE_ENV and VERSION when building (#700)

* Set NODE_ENV and VERSION when building

Should fix the version flag not reporting correctly as well as enable
the service worker and prevent the 404 hmr requests again.

* Log env vars

To help make sure it's built correctly when looking at the Travis logs.
上级 c020cd2f
import { register, run } from "@coder/runner"; import { register, run } from "@coder/runner";
import { logger, field } from "@coder/logger";
import * as fs from "fs"; import * as fs from "fs";
import * as fse from "fs-extra"; import * as fse from "fs-extra";
import * as os from "os"; import * as os from "os";
...@@ -17,6 +18,11 @@ const vscodeVersion = process.env.VSCODE_VERSION || "1.33.1"; ...@@ -17,6 +18,11 @@ const vscodeVersion = process.env.VSCODE_VERSION || "1.33.1";
const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`; const vsSourceUrl = `https://codesrv-ci.cdr.sh/vstar-${vscodeVersion}.tar.gz`;
const buildServerBinary = register("build:server:binary", async (runner) => { const buildServerBinary = register("build:server:binary", async (runner) => {
logger.info("Building with environment", field("env", {
NODE_ENV: process.env.NODE_ENV,
VERSION: process.env.VERSION,
}));
await ensureInstalled(); await ensureInstalled();
await Promise.all([ await Promise.all([
buildBootstrapFork(), buildBootstrapFork(),
......
...@@ -15,13 +15,13 @@ function docker_build() { ...@@ -15,13 +15,13 @@ function docker_build() {
docker cp ./. $containerID:/src docker cp ./. $containerID:/src
exec "cd /src && yarn" exec "cd /src && yarn"
exec "cd /src && npm rebuild" exec "cd /src && npm rebuild"
exec "cd /src && yarn task build:server:binary" exec "cd /src && NODE_ENV=production VERSION=$VERSION yarn task build:server:binary"
exec "cd /src && yarn task package $VERSION" exec "cd /src && yarn task package $VERSION"
docker cp $containerID:/src/release/. ./release/ docker cp $containerID:/src/release/. ./release/
} }
if [[ "$OSTYPE" == "darwin"* ]]; then if [[ "$OSTYPE" == "darwin"* ]]; then
yarn task build:server:binary NODE_ENV=production yarn task build:server:binary
else else
if [[ "$TARGET" == "alpine" ]]; then if [[ "$TARGET" == "alpine" ]]; then
IMAGE="codercom/nbin-alpine" IMAGE="codercom/nbin-alpine"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册