fix(core): update
This commit is contained in:
parent
87ff0f01bb
commit
55f45b1c3a
@ -1,6 +1,5 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as docker from '../ts/index';
|
import * as docker from '../ts/index';
|
||||||
import { DockerService } from '../ts/index';
|
|
||||||
|
|
||||||
let testDockerHost: docker.DockerHost;
|
let testDockerHost: docker.DockerHost;
|
||||||
|
|
||||||
@ -94,8 +93,11 @@ tap.test('should create a service', async () => {
|
|||||||
labels: {},
|
labels: {},
|
||||||
contentArg: '{"hi": "wow"}'
|
contentArg: '{"hi": "wow"}'
|
||||||
});
|
});
|
||||||
const testService = await DockerService.createService(testDockerHost, {
|
const testImage = await docker.DockerImage.createFromRegistry(testDockerHost, {
|
||||||
image: 'nginx:latest',
|
imageUrl: 'nginx:latest'
|
||||||
|
});
|
||||||
|
const testService = await docker.DockerService.createService(testDockerHost, {
|
||||||
|
image: testImage,
|
||||||
labels: {
|
labels: {
|
||||||
'testlabel': 'hi'
|
'testlabel': 'hi'
|
||||||
},
|
},
|
||||||
|
@ -119,7 +119,13 @@ export class DockerImage {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public tagImage(newTag) {}
|
/**
|
||||||
|
* tag an image
|
||||||
|
* @param newTag
|
||||||
|
*/
|
||||||
|
public async tagImage(newTag) {
|
||||||
|
throw new Error('.tagImage is not yet implemented');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pulls the latest version from the registry
|
* pulls the latest version from the registry
|
||||||
|
@ -39,13 +39,11 @@ export class DockerService {
|
|||||||
// lets get the image
|
// lets get the image
|
||||||
plugins.smartlog.defaultLogger.log(
|
plugins.smartlog.defaultLogger.log(
|
||||||
'info',
|
'info',
|
||||||
`downloading image for service ${serviceCreationDescriptor.name}`
|
`now creating service ${serviceCreationDescriptor.name}`
|
||||||
);
|
);
|
||||||
const serviceImage = await DockerImage.createFromRegistry(dockerHost, {
|
|
||||||
imageUrl: serviceCreationDescriptor.image
|
|
||||||
});
|
|
||||||
|
|
||||||
const serviceVersion = serviceImage.Labels.version;
|
// await serviceCreationDescriptor.image.pullLatestImageFromRegistry();
|
||||||
|
const serviceVersion = await serviceCreationDescriptor.image.getVersion();
|
||||||
|
|
||||||
const labels: interfaces.TLabels = {
|
const labels: interfaces.TLabels = {
|
||||||
...serviceCreationDescriptor.labels,
|
...serviceCreationDescriptor.labels,
|
||||||
@ -78,7 +76,7 @@ export class DockerService {
|
|||||||
Name: serviceCreationDescriptor.name,
|
Name: serviceCreationDescriptor.name,
|
||||||
TaskTemplate: {
|
TaskTemplate: {
|
||||||
ContainerSpec: {
|
ContainerSpec: {
|
||||||
Image: serviceCreationDescriptor.image,
|
Image: serviceCreationDescriptor.image.RepoTags[0],
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
Secrets: secretArray
|
Secrets: secretArray
|
||||||
},
|
},
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import * as interfaces from './';
|
import * as interfaces from './';
|
||||||
import { DockerNetwork } from '../docker.classes.network';
|
import { DockerNetwork } from '../docker.classes.network';
|
||||||
import { DockerSecret } from '../docker.classes.secret';
|
import { DockerSecret } from '../docker.classes.secret';
|
||||||
|
import { DockerImage } from '../docker.classes.image';
|
||||||
|
|
||||||
export interface IServiceCreationDescriptor {
|
export interface IServiceCreationDescriptor {
|
||||||
name: string;
|
name: string;
|
||||||
image: string;
|
image: DockerImage;
|
||||||
labels: interfaces.TLabels;
|
labels: interfaces.TLabels;
|
||||||
networks: DockerNetwork[];
|
networks: DockerNetwork[];
|
||||||
networkAlias: string;
|
networkAlias: string;
|
||||||
|
Loading…
Reference in New Issue
Block a user