mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(templates): add support for the template registry field
This commit is contained in:
parent
8869a2c79c
commit
b5bf7cdead
7 changed files with 33 additions and 42 deletions
|
@ -129,9 +129,18 @@ function ($scope, $q, $state, $filter, $anchorScroll, Config, Info, Container, C
|
|||
});
|
||||
}
|
||||
preparePortBindings(containerConfig, $scope.formValues.ports);
|
||||
prepareImageConfig(containerConfig, template);
|
||||
return containerConfig;
|
||||
}
|
||||
|
||||
function prepareImageConfig(config, template) {
|
||||
var image = _.toLower(template.image);
|
||||
var registry = template.registry;
|
||||
var imageConfig = ImageHelper.createImageConfigForContainer(image, registry);
|
||||
config.Image = imageConfig.fromImage + ':' + imageConfig.tag;
|
||||
$scope.imageConfig = imageConfig;
|
||||
}
|
||||
|
||||
function prepareVolumeQueries(template, containerConfig) {
|
||||
var volumeQueries = [];
|
||||
if (template.volumes) {
|
||||
|
@ -158,13 +167,9 @@ function ($scope, $q, $state, $filter, $anchorScroll, Config, Info, Container, C
|
|||
$('#createContainerSpinner').show();
|
||||
var template = $scope.state.selectedTemplate;
|
||||
var containerConfig = createConfigFromTemplate(template);
|
||||
var imageConfig = {
|
||||
fromImage: template.image.split(':')[0],
|
||||
tag: template.image.split(':')[1] ? template.image.split(':')[1] : 'latest'
|
||||
};
|
||||
var createVolumeQueries = prepareVolumeQueries(template, containerConfig);
|
||||
$q.all(createVolumeQueries).then(function (d) {
|
||||
pullImageAndCreateContainer(imageConfig, containerConfig);
|
||||
pullImageAndCreateContainer($scope.imageConfig, containerConfig);
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue