Compare commits

...

2 Commits

Author SHA1 Message Date
Asher
04adf14146 Move OSX package task into build script
This is to match how the other binaries are built. Also made some
changes to make the Docker containers clean up for when you are running
this locally.
2019-06-06 13:43:37 -05:00
Liudas Sodonis aka lfx aka lso
406ec0ba71 Updated google_cloud to have proper link to ssl.md (#745) 2019-06-05 15:28:10 -05:00
4 changed files with 44 additions and 24 deletions

View File

@@ -27,7 +27,6 @@ before_deploy:
- git config --local user.name "$USER_NAME" - git config --local user.name "$USER_NAME"
- git config --local user.email "$USER_EMAIL" - git config --local user.email "$USER_EMAIL"
- git tag "$VERSION" "$TRAVIS_COMMIT" - git tag "$VERSION" "$TRAVIS_COMMIT"
- if [[ “$TRAVIS_OS_NAME” == “osx” ]]; then yarn task package $VERSION; fi
deploy: deploy:
provider: releases provider: releases
file_glob: true file_glob: true

View File

@@ -21,6 +21,8 @@ const buildServerBinary = register("build:server:binary", async (runner) => {
logger.info("Building with environment", field("env", { logger.info("Building with environment", field("env", {
NODE_ENV: process.env.NODE_ENV, NODE_ENV: process.env.NODE_ENV,
VERSION: process.env.VERSION, VERSION: process.env.VERSION,
OSTYPE: process.env.OSTYPE,
TARGET: process.env.TARGET,
})); }));
await ensureInstalled(); await ensureInstalled();

View File

@@ -50,7 +50,7 @@ cd code-server-{version}-linux-x64
chmod +x code-server chmod +x code-server
``` ```
> To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../security/ssl.md) > To ensure the connection between you and your server is encrypted view our guide on [securing your setup](../../security/ssl.md)
- Start the code-server - Start the code-server
``` ```

View File

@@ -1,32 +1,51 @@
#!/bin/bash #!/bin/bash
set -euxo pipefail set -euxo pipefail
# Variables to be set: # Build using a Docker container using the specified image and version.
# $IMAGE
function docker_build() { function docker_build() {
containerID=$(docker create -it -v $(pwd)/.cache:/src/.cache $IMAGE) local image="${1}" ; shift
docker start $containerID local version="${1}" ; shift
docker exec $containerID mkdir -p /src
function exec() { local containerId
docker exec $containerID bash -c "$@" containerId=$(docker create --network=host --rm -it -v "$(pwd)"/.cache:/src/.cache "${image}")
docker start "${containerId}"
docker exec "${containerId}" mkdir -p /src
function docker_exec() {
docker exec "${containerId}" bash -c "$@"
} }
docker cp ./. $containerID:/src docker cp ./. "${containerId}":/src
exec "cd /src && yarn" docker_exec "cd /src && yarn"
exec "cd /src && npm rebuild" docker_exec "cd /src && npm rebuild"
exec "cd /src && NODE_ENV=production VERSION=$VERSION yarn task build:server:binary" docker_exec "cd /src && NODE_ENV=production VERSION=${version} yarn task build:server:binary"
exec "cd /src && yarn task package $VERSION" docker_exec "cd /src && yarn task package ${version}"
docker cp $containerID:/src/release/. ./release/ docker cp "${containerId}":/src/release/. ./release/
docker stop "${containerId}"
} }
if [[ "$OSTYPE" == "darwin"* ]]; then function main() {
NODE_ENV=production yarn task build:server:binary local version=${VERSION:-}
else local ostype=${OSTYPE:-}
if [[ "$TARGET" == "alpine" ]]; then
IMAGE="codercom/nbin-alpine" if [[ -z "${version}" ]] ; then
else >&2 echo "Must set VERSION environment variable"
IMAGE="codercom/nbin-centos" exit 1
fi fi
docker_build
fi if [[ "${ostype}" == "darwin"* ]]; then
NODE_ENV=production VERSION="${version}" yarn task build:server:binary
yarn task package "${version}"
else
local image
if [[ "$TARGET" == "alpine" ]]; then
image="codercom/nbin-alpine"
else
image="codercom/nbin-centos"
fi
docker_build "${image}" "${version}"
fi
}
main "$@"