diff options
author | Elizabeth Hunt <me@liz.coffee> | 2025-07-20 23:01:00 -0700 |
---|---|---|
committer | Elizabeth Hunt <me@liz.coffee> | 2025-07-20 23:01:00 -0700 |
commit | 0c3131c650178c5265b9ebeb021c59c86427ae6e (patch) | |
tree | c3b39b5a2d0ef2cc417a4df50ff959bce898370d | |
parent | f64406cd9ceb69b798b0b8d50c902d84750fdfbf (diff) | |
download | ci-0c3131c650178c5265b9ebeb021c59c86427ae6e.tar.gz ci-0c3131c650178c5265b9ebeb021c59c86427ae6e.zip |
Fixes image tagging
-rwxr-xr-x | worker/scripts/build_docker_image.ts | 15 |
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)]; } |