mirror of https://github.com/docker/docs.git
				
				
				
			Docker-machine 0.3.0 RC with optional binaries
This commit is contained in:
		
							parent
							
								
									43b1b9249a
								
							
						
					
					
						commit
						d58b6779db
					
				|  | @ -13,7 +13,7 @@ identity* | |||
| integration | ||||
| 
 | ||||
| # Resources | ||||
| resources/docker-* | ||||
| resources/docker* | ||||
| resources/boot2docker-* | ||||
| 
 | ||||
| # Cache | ||||
|  |  | |||
|  | @ -26,7 +26,7 @@ | |||
|     } | ||||
|   ], | ||||
|   "docker-version": "1.6.2", | ||||
|   "docker-machine-version": "0.2.0", | ||||
|   "docker-machine-version": "0.3.0", | ||||
|   "electron-version": "0.26.0", | ||||
|   "virtualbox-version": "4.3.28", | ||||
|   "virtualbox-filename": "VirtualBox-4.3.28.pkg", | ||||
|  |  | |||
|  | @ -6,6 +6,7 @@ var util = require('./utils/Util'); | |||
| var setupUtil = require('./utils/SetupUtil'); | ||||
| var metrics = require('./utils/MetricsUtil'); | ||||
| var machine = require('./utils/DockerMachineUtil'); | ||||
| var dialog = remote.require('dialog'); | ||||
| import docker from './utils/DockerUtil'; | ||||
| 
 | ||||
| // main.js
 | ||||
|  | @ -21,23 +22,6 @@ var MenuTemplate = function () { | |||
|       { | ||||
|         type: 'separator' | ||||
|       }, | ||||
|       { | ||||
|         label: 'Install Docker Commands', | ||||
|         enabled: true, | ||||
|         click: function () { | ||||
|           metrics.track('Installed Docker Commands'); | ||||
|           if (!setupUtil.shouldUpdateBinaries()) { | ||||
|             return; | ||||
|           } | ||||
| 
 | ||||
|           if (setupUtil.needsBinaryFix()) { | ||||
|             let cmd = setupUtil.copyBinariesCmd() + ' && ' + setupUtil.fixBinariesCmd(); | ||||
|             util.exec(setupUtil.macSudoCmd(cmd)).catch(() => {}); | ||||
|           } else { | ||||
|             util.exec(setupUtil.copyBinariesCmd()); | ||||
|           } | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         label: 'Preferences', | ||||
|         accelerator: util.CommandOrCtrl() + '+,', | ||||
|  | @ -53,8 +37,25 @@ var MenuTemplate = function () { | |||
|         type: 'separator' | ||||
|       }, | ||||
|       { | ||||
|         label: 'Services', | ||||
|         submenu: [] | ||||
|         label: 'Install Docker Commands', | ||||
|         enabled: true, | ||||
|         click: function () { | ||||
|           metrics.track('Installed Docker Commands'); | ||||
|           if (!setupUtil.shouldUpdateBinaries()) { | ||||
|             return; | ||||
|           } | ||||
| 
 | ||||
|           let copy = setupUtil.needsBinaryFix() ? | ||||
|                util.exec(setupUtil.copyBinariesCmd() + ' && ' + setupUtil.fixBinariesCmd()) : | ||||
|                util.exec(setupUtil.copyBinariesCmd()); | ||||
| 
 | ||||
|           copy.then(() => { | ||||
|             dialog.showMessageBox({ | ||||
|               message: 'Docker Binaries have been copied to /usr/local/bin', | ||||
|               buttons: ['OK'] | ||||
|             }); | ||||
|           }).catch(() => {}); | ||||
|         }, | ||||
|       }, | ||||
|       { | ||||
|         type: 'separator' | ||||
|  |  | |||
|  | @ -72,7 +72,7 @@ var DockerMachine = { | |||
|     return util.exec([this.command(), 'rm', '-f', NAME]); | ||||
|   }, | ||||
|   ip: function () { | ||||
|     return util.exec([this.command(), '-D', 'ip', NAME]).then(stdout => { | ||||
|     return util.exec([this.command(), 'ip', NAME]).then(stdout => { | ||||
|       return Promise.resolve(stdout.trim().replace('\n', '')); | ||||
|     }); | ||||
|   }, | ||||
|  |  | |||
|  | @ -17,7 +17,7 @@ export default { | |||
| 
 | ||||
|   setup (ip, name) { | ||||
|     if (!ip || !name) { | ||||
|       throw new Error('Falsy ip or machine name passed to init'); | ||||
|       throw new Error('Falsy ip or name passed to docker client setup'); | ||||
|     } | ||||
| 
 | ||||
|     let certDir = path.join(util.home(), '.docker/machine/machines/', name); | ||||
|  | @ -25,6 +25,8 @@ export default { | |||
|       throw new Error('Certificate directory does not exist'); | ||||
|     } | ||||
| 
 | ||||
|     console.log(ip); | ||||
| 
 | ||||
|     this.host = ip; | ||||
|     this.client = new dockerode({ | ||||
|       protocol: 'https', | ||||
|  |  | |||
|  | @ -12,9 +12,9 @@ module.exports = { | |||
|     return path.join(this.resourceDir(), 'terminal'); | ||||
|   }, | ||||
|   docker: function () { | ||||
|     return path.join(this.resourceDir(), 'docker-' + util.packagejson()['docker-version'] + util.binsEnding()); | ||||
|     return path.join(this.resourceDir(), 'docker' + util.binsEnding()); | ||||
|   }, | ||||
|   dockerMachine: function () { | ||||
|     return path.join(this.resourceDir(), 'docker-machine-' + util.packagejson()['docker-machine-version'] + util.binsEnding()); | ||||
|     return path.join(this.resourceDir(), 'docker-machine' + util.binsEnding()); | ||||
|   } | ||||
| }; | ||||
|  |  | |||
							
								
								
									
										21
									
								
								util/deps
								
								
								
								
							
							
						
						
									
										21
									
								
								util/deps
								
								
								
								
							|  | @ -1,29 +1,30 @@ | |||
| #!/bin/bash | ||||
| DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||||
| BASE=$DIR/.. | ||||
| DOCKER_MACHINE_CLI_VERSION=$(node -pe "JSON.parse(process.argv[1])['docker-machine-version']" "$(cat $BASE/package.json)") | ||||
| DOCKER_MACHINE_CLI_FILE=docker-machine-$DOCKER_MACHINE_CLI_VERSION | ||||
| DOCKER_VERSION=$(node -pe "JSON.parse(process.argv[1])['docker-version']" "$(cat $BASE/package.json)") | ||||
| DOCKER_CLI_FILE=docker-$DOCKER_VERSION | ||||
| DOCKER_MACHINE_VERSION=$(node -pe "JSON.parse(process.argv[1])['docker-machine-version']" "$(cat $BASE/package.json)") | ||||
| CURRENT_DOCKER_VERSION=$($BASE/resources/docker -v | cut -d ',' -f1 | awk '{print $3}' | cut -d '-' -f1) | ||||
| CURRENT_DOCKER_MACHINE_VERSION=$($BASE/resources/docker-machine -v | cut -d ',' -f1 | awk '{print $3}' | cut -d '-' -f1) | ||||
| BOOT2DOCKER_FILE=boot2docker-$DOCKER_VERSION.iso | ||||
| 
 | ||||
| pushd $BASE/resources > /dev/null | ||||
| 
 | ||||
| if [ ! -f $DOCKER_CLI_FILE ]; then | ||||
| if [ "$DOCKER_VERSION" != "$CURRENT_DOCKER_VERSION" ]; then | ||||
|   echo "-----> Downloading Docker CLI..." | ||||
|   rm -rf docker | ||||
|   rm -rf docker-* | ||||
|   curl -L -o docker-$DOCKER_VERSION.tgz https://get.docker.com/builds/Darwin/x86_64/docker-$DOCKER_VERSION.tgz | ||||
|   tar xvzf docker-$DOCKER_VERSION.tgz --strip=3 | ||||
|   rm docker-$DOCKER_VERSION.tgz | ||||
|   mv docker docker-$DOCKER_VERSION | ||||
|   chmod +x $DOCKER_VERSION | ||||
|   chmod +x docker | ||||
| fi | ||||
| 
 | ||||
| if [ ! -f $DOCKER_MACHINE_CLI_FILE ]; then | ||||
| if [ "$DOCKER_MACHINE_VERSION" != "$CURRENT_DOCKER_MACHINE_VERSION" ]; then | ||||
|   echo "-----> Downloading Docker Machine CLI..." | ||||
|   rm -rf docker-machine* | ||||
|   curl -L -o $DOCKER_MACHINE_CLI_FILE https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_CLI_VERSION/docker-machine_darwin-amd64 | ||||
|   chmod +x $DOCKER_MACHINE_CLI_FILE | ||||
|   rm -rf docker-machine | ||||
|   rm -rf docker-machine-* | ||||
|   curl -L -o docker-machine https://github.com/docker/machine/releases/download/v$DOCKER_MACHINE_VERSION-rc1/docker-machine_darwin-amd64 | ||||
|   chmod +x docker-machine | ||||
| fi | ||||
| 
 | ||||
| if [ ! -f $BOOT2DOCKER_FILE ]; then | ||||
|  |  | |||
|  | @ -8,21 +8,19 @@ $packageJsonContent = $serializer.DeserializeObject($packageJson) | |||
| $webclient = New-Object System.Net.WebClient | ||||
| 
 | ||||
| $DOCKER_MACHINE_CLI_VERSION = $packageJsonContent['docker-machine-version'] | ||||
| $DOCKER_MACHINE_CLI_FILE = 'docker-machine-' + $DOCKER_MACHINE_CLI_VERSION + '.exe' | ||||
| $DOCKER_CLI_VERSION = $packageJsonContent['docker-version'] | ||||
| $DOCKER_CLI_FILE = 'docker-' + $DOCKER_CLI_VERSION + '.exe' | ||||
| 
 | ||||
| 
 | ||||
| if(-Not (test-path ($BasePath + '\resources\' + $DOCKER_CLI_FILE))) { | ||||
| if(-Not (test-path ($BasePath + '\resources\docker'))) { | ||||
|     echo "-----> Downloading Docker CLI..." | ||||
|     $source = "https://master.dockerproject.com/windows/amd64/docker.exe" | ||||
|     $destination = $BasePath + "\resources\" + $DOCKER_CLI_FILE | ||||
|     $destination = $BasePath + "\resources\docker" | ||||
|     $webclient.DownloadFile($source, $destination) | ||||
| } | ||||
| 
 | ||||
| if(-Not (test-path ($BasePath + '\resources\' + $DOCKER_MACHINE_CLI_FILE))) { | ||||
|     echo "-----> Downloading Docker Machine CLI..."  | ||||
|     $source = "https://github.com/docker/machine/releases/download/v0.1.0/docker-machine_windows-amd64.exe" | ||||
|     $destination = $BasePath + "\resources\" + $DOCKER_MACHINE_CLI_FILE  | ||||
| if(-Not (test-path ($BasePath + '\resources\docker-machine'))) { | ||||
|     echo "-----> Downloading Docker Machine CLI..." | ||||
|     $source = "https://github.com/docker/machine/releases/download/v" + $DOCKER_MACHINE_VERSION+ "/docker-machine_windows-amd64.exe" | ||||
|     $destination = $BasePath + "\resources\docker-machine" | ||||
|     $webclient.DownloadFile($source, $destination) | ||||
| } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue