add push
This commit is contained in:
Родитель
46922eb706
Коммит
7cbe79d3f9
|
@ -45,7 +45,7 @@ export function buildImage() {
|
|||
vscode.window.showQuickPick(items, { placeHolder: 'Choose Dockerfile to build' }).then(function(selectedItem : Item) {
|
||||
if (selectedItem) {
|
||||
let terminal: vscode.Terminal = vscode.window.createTerminal('Docker');
|
||||
let imageName: string = vscode.workspace.rootPath.split('/').pop().toLowerCase();
|
||||
let imageName: string = selectedItem.path.split('/').pop().toLowerCase();
|
||||
let configOptions: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration('docker');
|
||||
let defaultRegistry: string = configOptions.get('defaultRegistry', '');
|
||||
let defaultRegistryPath: string = configOptions.get('defaultRegistryPath', '');
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import vscode = require('vscode');
|
||||
import {docker} from './docker-endpoint';
|
||||
import * as Docker from 'dockerode';
|
||||
|
||||
interface Item extends vscode.QuickPickItem {
|
||||
id: string,
|
||||
}
|
||||
|
||||
function createItem(image: Docker.ImageDesc) : Item {
|
||||
return <Item> {
|
||||
label: image.RepoTags[0] || '<none>',
|
||||
description: null,
|
||||
id: image.Id
|
||||
};
|
||||
}
|
||||
|
||||
function computeItems(images: Docker.ImageDesc[]) : vscode.QuickPickItem[] {
|
||||
let items : vscode.QuickPickItem[] = [];
|
||||
for (let i = 0; i < images.length; i++) {
|
||||
items.push(createItem(images[i]));
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
export function pushImage() {
|
||||
docker.getImageDescriptors().then(images => {
|
||||
if (!images || images.length == 0) {
|
||||
vscode.window.showInformationMessage('There are no docker images yet. Try Build first.');
|
||||
} else {
|
||||
let items: vscode.QuickPickItem[] = computeItems(images);
|
||||
vscode.window.showQuickPick(items, { placeHolder: 'Choose image to push' }).then(function(selectedItem : Item) {
|
||||
if (selectedItem) {
|
||||
let terminal: vscode.Terminal = vscode.window.createTerminal(selectedItem.label);
|
||||
terminal.sendText(`docker push ${selectedItem.label}`);
|
||||
terminal.show();
|
||||
};
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ import {DockerfileParser} from './dockerfile/dockerfileParser';
|
|||
import vscode = require('vscode');
|
||||
import {buildImage} from './commands/build-image';
|
||||
import {removeImage} from './commands/remove-image';
|
||||
import {pushImage} from './commands/push-image';
|
||||
import {startContainer} from './commands/start-container';
|
||||
import {stopContainer} from './commands/stop-container';
|
||||
import {showLogsContainer} from './commands/showlogs-container';
|
||||
|
@ -31,6 +32,7 @@ export function activate(ctx: vscode.ExtensionContext): void {
|
|||
|
||||
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.build', buildImage));
|
||||
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.remove', removeImage));
|
||||
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.push', pushImage));
|
||||
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.start', startContainer));
|
||||
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.stop', stopContainer));
|
||||
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.show-logs', showLogsContainer));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
"onLanguage:yaml",
|
||||
"onCommand:vscode-docker.image.build",
|
||||
"onCommand:vscode-docker.image.remove",
|
||||
"onCommand:vscode-docker.image.push",
|
||||
"onCommand:vscode-docker.container.start",
|
||||
"onCommand:vscode-docker.container.stop",
|
||||
"onCommand:vscode-docker.container.show-logs",
|
||||
|
@ -110,6 +111,11 @@
|
|||
"command": "vscode-docker.compose.down",
|
||||
"title": "Docker: Compose Down",
|
||||
"description": "Stops a composition of containers"
|
||||
},
|
||||
{
|
||||
"command": "vscode-docker.image.push",
|
||||
"title": "Docker: Push",
|
||||
"description": "Push an image to a registry"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче