Skip to content

Instantly share code, notes, and snippets.

@Sahil624
Created March 8, 2019 09:37
Show Gist options
  • Save Sahil624/4b959f0e0523a799941541080e3e2370 to your computer and use it in GitHub Desktop.
Save Sahil624/4b959f0e0523a799941541080e3e2370 to your computer and use it in GitHub Desktop.
const child_process = require('child_process');
const fs = require('fs');
console.log('here')
if (fs.existsSync('code-server-1.31.1-100-linux-x64')) {
console.log('Binary exists');
} else {
console.log('Downloading');
child_process.execSync('wget https://github.com/codercom/code-server/releases/download/' +
'1.31.1-100/code-server-1.31.1-100-linux-x64.tar.gz')
console.log('there')
child_process.execSync('tar -xzf code-server-1.31.1-100-linux-x64.tar.gz')
}
const port = process.env.port || 8080
child_process.execSync('cd code-server-1.31.1-100-linux-x64/')
try {
child_process.execSync(`docker run -p localhost:8443:8443 -v "${PWD}:/root/project"
codercom/code-server code-server --allow-http --no-auth`)
} catch (error) {
console.log('starting at port ', port);
child_process.execSync(`code-server-1.31.1-100-linux-x64/code-server -p ${port}`)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment