|
|
|
@@ -214,6 +214,7 @@ export class Dockerfile {
|
|
|
|
public version: string;
|
|
|
|
public version: string;
|
|
|
|
public cleanTag: string;
|
|
|
|
public cleanTag: string;
|
|
|
|
public buildTag: string;
|
|
|
|
public buildTag: string;
|
|
|
|
|
|
|
|
public pushTag: string;
|
|
|
|
public containerName: string;
|
|
|
|
public containerName: string;
|
|
|
|
public content: string;
|
|
|
|
public content: string;
|
|
|
|
public baseImage: string;
|
|
|
|
public baseImage: string;
|
|
|
|
@@ -248,7 +249,9 @@ export class Dockerfile {
|
|
|
|
public async build() {
|
|
|
|
public async build() {
|
|
|
|
logger.log('info', 'now building Dockerfile for ' + this.cleanTag);
|
|
|
|
logger.log('info', 'now building Dockerfile for ' + this.cleanTag);
|
|
|
|
const buildArgsString = await Dockerfile.getDockerBuildArgs(this.npmciDockerManagerRef);
|
|
|
|
const buildArgsString = await Dockerfile.getDockerBuildArgs(this.npmciDockerManagerRef);
|
|
|
|
const buildCommand = `docker build -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`;
|
|
|
|
const buildCommand = `docker build --label="version=${
|
|
|
|
|
|
|
|
this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo.npm.version
|
|
|
|
|
|
|
|
}" -t ${this.buildTag} -f ${this.filePath} ${buildArgsString} .`;
|
|
|
|
await bash(buildCommand);
|
|
|
|
await bash(buildCommand);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -257,21 +260,24 @@ export class Dockerfile {
|
|
|
|
* pushes the Dockerfile to a registry
|
|
|
|
* pushes the Dockerfile to a registry
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
|
|
|
|
public async push(dockerRegistryArg: DockerRegistry, versionSuffix: string = null) {
|
|
|
|
const pushTag = Dockerfile.getDockerTagString(
|
|
|
|
this.pushTag = Dockerfile.getDockerTagString(
|
|
|
|
this.npmciDockerManagerRef,
|
|
|
|
this.npmciDockerManagerRef,
|
|
|
|
dockerRegistryArg.registryUrl,
|
|
|
|
dockerRegistryArg.registryUrl,
|
|
|
|
this.repo,
|
|
|
|
this.repo,
|
|
|
|
this.version,
|
|
|
|
this.version,
|
|
|
|
versionSuffix
|
|
|
|
versionSuffix
|
|
|
|
);
|
|
|
|
);
|
|
|
|
await bash(`docker tag ${this.buildTag} ${pushTag}`);
|
|
|
|
await bash(`docker tag ${this.buildTag} ${this.pushTag}`);
|
|
|
|
await bash(`docker push ${pushTag}`);
|
|
|
|
await bash(`docker push ${this.pushTag}`);
|
|
|
|
const imageDigest = (await bash(
|
|
|
|
console.log('you can get the digest using this command');
|
|
|
|
|
|
|
|
console.log(`docker inspect --format='{{index .RepoDigests 0}}' ${this.pushTag}`);
|
|
|
|
|
|
|
|
/* const imageDigest = (await bash(
|
|
|
|
`docker inspect --format='{{index .RepoDigests 0}}' ${pushTag}`
|
|
|
|
`docker inspect --format='{{index .RepoDigests 0}}' ${pushTag}`
|
|
|
|
)).split('@')[1];
|
|
|
|
)).split('@')[1]; */
|
|
|
|
await this.npmciDockerManagerRef.npmciRef.cloudlyConnector.announceDockerContainer({
|
|
|
|
await this.npmciDockerManagerRef.npmciRef.cloudlyConnector.announceDockerContainer({
|
|
|
|
dockerImageUrl: pushTag,
|
|
|
|
dockerImageUrl: this.pushTag,
|
|
|
|
dockerImageVersion: imageDigest
|
|
|
|
dockerImageVersion: this.npmciDockerManagerRef.npmciRef.npmciConfig.getConfig().projectInfo
|
|
|
|
|
|
|
|
.npm.version
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|