MCPcopy
hub / github.com/triggerdotdev/trigger.dev / buildAndPushImage

Function buildAndPushImage

packages/cli-v3/src/commands/deploy.ts:787–908  ·  view source on GitHub ↗
(
  options: BuildAndPushImageOptions,
  updater: ReturnType<typeof spinner>
)

Source from the content-addressed store, hash-verified

785 };
786
787async function buildAndPushImage(
788 options: BuildAndPushImageOptions,
789 updater: ReturnType<typeof spinner>
790): Promise<BuildAndPushImageResults> {
791 return tracer.startActiveSpan("buildAndPushImage", async (span) => {
792 span.setAttributes({
793 "options.registryHost": options.registryHost,
794 "options.imageTag": options.imageTag,
795 "options.buildPlatform": options.buildPlatform,
796 "options.projectId": options.projectId,
797 "options.deploymentId": options.deploymentId,
798 "options.deploymentVersion": options.deploymentVersion,
799 "options.contentHash": options.contentHash,
800 "options.projectRef": options.projectRef,
801 "options.loadImage": options.loadImage,
802 });
803
804 // Step 3: Ensure we are "logged in" to our registry by writing to $HOME/.docker/config.json
805 // TODO: make sure this works on windows
806 const dockerConfigDir = await ensureLoggedIntoDockerRegistry(options.registryHost, {
807 username: "trigger",
808 password: options.auth,
809 });
810
811 const args = [
812 "build",
813 "-f",
814 "Containerfile",
815 options.noCache ? "--no-cache" : undefined,
816 "--platform",
817 options.buildPlatform,
818 "--provenance",
819 "false",
820 "--build-arg",
821 `TRIGGER_PROJECT_ID=${options.projectId}`,
822 "--build-arg",
823 `TRIGGER_DEPLOYMENT_ID=${options.deploymentId}`,
824 "--build-arg",
825 `TRIGGER_DEPLOYMENT_VERSION=${options.deploymentVersion}`,
826 "--build-arg",
827 `TRIGGER_CONTENT_HASH=${options.contentHash}`,
828 "--build-arg",
829 `TRIGGER_PROJECT_REF=${options.projectRef}`,
830 "-t",
831 `${options.registryHost}/${options.imageTag}`,
832 ".",
833 "--push",
834 options.loadImage ? "--load" : undefined,
835 ].filter(Boolean) as string[];
836
837 logger.debug(`depot ${args.join(" ")}`);
838
839 span.setAttribute("depot.command", `depot ${args.join(" ")}`);
840
841 // Step 4: Build and push the image
842 const childProcess = depot(args, {
843 cwd: options.cwd,
844 env: {

Callers 1

buildImageFunction · 0.85

Calls 9

extractLogsFunction · 0.85
extractImageDigestFunction · 0.85
recordSpanExceptionFunction · 0.85
startActiveSpanMethod · 0.80
toStringMethod · 0.80
filterMethod · 0.65
debugMethod · 0.65
onMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…