From 2be452d83ec41add5192cb0493bf93d7cdf3cdc0 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 17 Jul 2019 17:41:25 -0500 Subject: [PATCH] Fix rg extraction in Docker build --- .dockerignore | 6 +++++- scripts/tasks.bash | 2 +- src/util.ts | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.dockerignore b/.dockerignore index 007882d..f3341dd 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,11 @@ Dockerfile -doc/ +build +deployment +doc +.git .github .gitignore +.node-version .travis.yml LICENSE README.md diff --git a/scripts/tasks.bash b/scripts/tasks.bash index b4b593f..7412140 100755 --- a/scripts/tasks.bash +++ b/scripts/tasks.bash @@ -99,7 +99,7 @@ function build-code-server() { log "Installing remote dependencies" cd "${vscodeSourcePath}/remote" yarn --production --force --build-from-source - cp -r "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}" + mv "${vscodeSourcePath}/remote/node_modules" "${codeServerBuildPath}" # Only keep the production dependencies. cd "${codeServerBuildPath}/out/vs/server" diff --git a/src/util.ts b/src/util.ts index e1aca6f..983a8ce 100644 --- a/src/util.ts +++ b/src/util.ts @@ -122,10 +122,12 @@ export const open = async (url: string): Promise => { */ export const unpackExecutables = async (): Promise => { const rgPath = (rg as any).binaryRgPath; - if (rgPath) { + const destination = path.join(tmpdir, path.basename(rgPath || "")); + if (rgPath && !(await util.promisify(fs.exists)(destination))) { await mkdirp(tmpdir); - const destination = path.join(tmpdir, path.basename(rgPath)); - await util.promisify(fs.copyFile)(rgPath, destination); + // TODO: I'm not sure why but copyFile doesn't work in the Docker build. + // await util.promisify(fs.copyFile)(rgPath, destination); + await util.promisify(fs.writeFile)(destination, await util.promisify(fs.readFile)(rgPath)); await util.promisify(fs.chmod)(destination, "755"); } };