summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xworker/scripts/build_docker_image.ts15
1 files changed, 10 insertions, 5 deletions
diff --git a/worker/scripts/build_docker_image.ts b/worker/scripts/build_docker_image.ts
index fffeef3..3ca5646 100755
--- a/worker/scripts/build_docker_image.ts
+++ b/worker/scripts/build_docker_image.ts
@@ -106,7 +106,7 @@ await LogMetricTraceable.ofLogTraceable(_logJob)
.map(async (tEitherWithBuiltImage) => {
const eitherWithBuiltImage = await tEitherWithBuiltImage.get();
return eitherWithBuiltImage
- .mapRight(({ job }) => tEitherWithBuiltImage.move(getPushCommand(job.arguments.imageTag)))
+ .mapRight(({ job }) => tEitherWithBuiltImage.move(getPushCommand(job.arguments)))
.flatMapAsync((tPushCommand) => getStdout(tPushCommand));
})
.map(async (tEitherJob) => {
@@ -122,10 +122,15 @@ function getDockerLoginCommand(username: string, registry: string): Command {
return `docker login --username ${username} --password $REGISTRY_PASSWORD ${registry}`.split(' ');
}
-function getBuildCommand({ buildTarget, imageTag, dockerfile, context }: BuildDockerImageJobProps): Command {
- return ['docker', 'build', '--target', buildTarget, '-t', imageTag, '-f', path.join(context, dockerfile), context];
+function getBuildCommand(args: BuildDockerImageJobProps): Command {
+ const { buildTarget, dockerfile, context } = args;
+ const tag = getImageTag(args);
+ return ['docker', 'build', '--target', buildTarget, '-t', tag, '-f', path.join(context, dockerfile), context];
}
-function getPushCommand(tag: string): Command {
- return ['docker', 'push', tag];
+function getImageTag({ registry, namespace, repository, imageTag }: BuildDockerImageJobProps) {
+ return `${registry}/${namespace}/${repository}:${imageTag}`;
+}
+function getPushCommand(args: BuildDockerImageJobProps): Command {
+ return ['docker', 'push', getImageTag(args)];
}