Allow specifying the target

You still must build on the target system though because of the native
Node modules.
This commit is contained in:
Asher 2019-08-05 11:03:47 -05:00
parent dde683d911
commit 590f699687
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
2 changed files with 13 additions and 12 deletions

View File

@ -3,6 +3,7 @@ set -euo pipefail
# Build using a Docker container. # Build using a Docker container.
function docker-build() { function docker-build() {
local target="${TARGET:-}"
local image="codercom/nbin-${target}" local image="codercom/nbin-${target}"
if [[ "${target}" == "linux" ]] ; then if [[ "${target}" == "linux" ]] ; then
image="codercom/nbin-centos" image="codercom/nbin-centos"
@ -23,7 +24,7 @@ function docker-build() {
function docker-exec() { function docker-exec() {
local command="${1}" ; shift local command="${1}" ; shift
local args="'${vscodeVersion}' '${codeServerVersion}'" local args="'${vscodeVersion}' '${codeServerVersion}' '${target}'"
docker exec "${containerId}" \ docker exec "${containerId}" \
bash -c "cd /src && CI=true yarn ${command} ${args}" bash -c "cd /src && CI=true yarn ${command} ${args}"
} }
@ -54,7 +55,6 @@ function main() {
local codeServerVersion="${VERSION:-}" local codeServerVersion="${VERSION:-}"
local vscodeVersion="${VSCODE_VERSION:-}" local vscodeVersion="${VSCODE_VERSION:-}"
local ostype="${OSTYPE:-}" local ostype="${OSTYPE:-}"
local target="${TARGET:-}"
if [[ -z "${codeServerVersion}" ]] ; then if [[ -z "${codeServerVersion}" ]] ; then
>&2 echo "Must set VERSION environment variable"; exit 1 >&2 echo "Must set VERSION environment variable"; exit 1
@ -65,7 +65,6 @@ function main() {
fi fi
if [[ "${ostype}" == "darwin"* ]]; then if [[ "${ostype}" == "darwin"* ]]; then
target=darwin
local-build local-build
else else
docker-build docker-build

View File

@ -240,18 +240,20 @@ function main() {
exit 0 exit 0
fi fi
local codeServerVersion="${1}" ; shift
local ci="${CI:-}" local ci="${CI:-}"
local minify="${MINIFY:-}" local minify="${MINIFY:-}"
local arch="x86_64" local arch
local target="linux" arch=$(uname -m)
local ostype="${OSTYPE:-}" local target="${1:-}"
if [[ "${ostype}" == "darwin"* ]] ; then if [[ -z "${target}" ]] ; then
target="darwin" local ostype="${OSTYPE:-}"
else if [[ "${ostype}" == "darwin"* ]] ; then
arch=$(uname -m) target="darwin"
else
target="linux"
fi
fi fi
local codeServerVersion="${1}" ; shift
local binaryName="code-server${codeServerVersion}-vsc${vscodeVersion}-${target}-${arch}" local binaryName="code-server${codeServerVersion}-vsc${vscodeVersion}-${target}-${arch}"
local buildPath="${stagingPath}/${binaryName}-built" local buildPath="${stagingPath}/${binaryName}-built"