mirror of
https://github.com/danog/code-server.git
synced 2024-12-14 18:28:13 +01:00
db39eacfa1
* 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.
33 lines
785 B
Bash
Executable File
33 lines
785 B
Bash
Executable File
#!/bin/bash
|
|
set -euxo pipefail
|
|
|
|
# Variables to be set:
|
|
# $IMAGE
|
|
function docker_build() {
|
|
containerID=$(docker create -it -v $(pwd)/.cache:/src/.cache $IMAGE)
|
|
docker start $containerID
|
|
docker exec $containerID mkdir -p /src
|
|
|
|
function exec() {
|
|
docker exec $containerID bash -c "$@"
|
|
}
|
|
|
|
docker cp ./. $containerID:/src
|
|
exec "cd /src && yarn"
|
|
exec "cd /src && npm rebuild"
|
|
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
|
|
NODE_ENV=production yarn task build:server:binary
|
|
else
|
|
if [[ "$TARGET" == "alpine" ]]; then
|
|
IMAGE="codercom/nbin-alpine"
|
|
else
|
|
IMAGE="codercom/nbin-centos"
|
|
fi
|
|
docker_build
|
|
fi
|