fix(core): update
This commit is contained in:
parent
5cf80944fe
commit
6c5e5644b1
10
test/test.ts
10
test/test.ts
@ -87,24 +87,22 @@ tap.test('should create a service', async () => {
|
|||||||
Name: 'testNetwork'
|
Name: 'testNetwork'
|
||||||
});
|
});
|
||||||
const testSecret = await docker.DockerSecret.createSecret(testDockerHost, {
|
const testSecret = await docker.DockerSecret.createSecret(testDockerHost, {
|
||||||
name: 'serviceSecret',
|
name: 'testSecret',
|
||||||
version: '0.0.1',
|
version: '0.0.1',
|
||||||
labels: {},
|
labels: {},
|
||||||
contentArg: '{"hi": "wow"}'
|
contentArg: '{"hi": "wow"}'
|
||||||
});
|
});
|
||||||
const testImage = await docker.DockerImage.createFromRegistry(testDockerHost, {
|
const testImage = await docker.DockerImage.createFromRegistry(testDockerHost, {
|
||||||
imageUrl: 'nginx:latest'
|
imageUrl: 'registry.gitlab.com/hosttoday/ht-docker-static'
|
||||||
});
|
});
|
||||||
const testService = await docker.DockerService.createService(testDockerHost, {
|
const testService = await docker.DockerService.createService(testDockerHost, {
|
||||||
image: testImage,
|
image: testImage,
|
||||||
labels: {
|
labels: {},
|
||||||
testlabel: 'hi'
|
|
||||||
},
|
|
||||||
name: 'testService',
|
name: 'testService',
|
||||||
networks: [testNetwork],
|
networks: [testNetwork],
|
||||||
networkAlias: 'testService',
|
networkAlias: 'testService',
|
||||||
secrets: [testSecret],
|
secrets: [testSecret],
|
||||||
ports: []
|
ports: ['3000:80']
|
||||||
});
|
});
|
||||||
|
|
||||||
await testService.remove();
|
await testService.remove();
|
||||||
|
@ -137,6 +137,10 @@ export class DockerImage {
|
|||||||
|
|
||||||
// get stuff
|
// get stuff
|
||||||
public async getVersion() {
|
public async getVersion() {
|
||||||
|
if (this.Labels && this.Labels.version) {
|
||||||
return this.Labels.version;
|
return this.Labels.version;
|
||||||
|
} else {
|
||||||
|
return 'x.x.x';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,8 +92,8 @@ export class DockerService {
|
|||||||
const containerPort = portArray[1];
|
const containerPort = portArray[1];
|
||||||
ports.push({
|
ports.push({
|
||||||
Protocol: 'tcp',
|
Protocol: 'tcp',
|
||||||
PublishedPort: parseInt(containerPort, 10),
|
PublishedPort: parseInt(hostPort, 10),
|
||||||
TargetPort: parseInt(hostPort, 10)
|
TargetPort: parseInt(containerPort, 10)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user