summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-07-20 23:01:00 -0700
committerElizabeth Hunt <me@liz.coffee>2025-07-20 23:01:00 -0700
commit0c3131c650178c5265b9ebeb021c59c86427ae6e (patch)
treec3b39b5a2d0ef2cc417a4df50ff959bce898370d
parentf64406cd9ceb69b798b0b8d50c902d84750fdfbf (diff)
downloadci-0c3131c650178c5265b9ebeb021c59c86427ae6e.tar.gz
ci-0c3131c650178c5265b9ebeb021c59c86427ae6e.zip
Fixes image tagging
-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)];
}