Skip to content

Set NODE_ENV and VERSION when building #700

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build/tasks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { register, run } from "@coder/runner";
import { logger, field } from "@coder/logger";
import * as fs from "fs";
import * as fse from "fs-extra";
import * as os from "os";
Expand All @@ -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 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 Promise.all([
buildBootstrapFork(),
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ function docker_build() {
docker cp ./. $containerID:/src
exec "cd /src && yarn"
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"
docker cp $containerID:/src/release/. ./release/
}

if [[ "$OSTYPE" == "darwin"* ]]; then
yarn task build:server:binary
NODE_ENV=production yarn task build:server:binary
else
if [[ "$TARGET" == "alpine" ]]; then
IMAGE="codercom/nbin-alpine"
Expand Down