Skip to content

Commit

Permalink
fix: handle registry URLs for private ghcr.io images
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalkadam47 committed Jan 24, 2025
1 parent c6569f7 commit 6aaef86
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/server/src/utils/builders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,22 @@ export const mechanizeDockerContainer = async (
};

const getImageName = (application: ApplicationNested) => {
const { appName, sourceType, dockerImage, registry } = application;
const { appName, sourceType, dockerImage, registry, registryUrl } = application;

if (sourceType === "docker") {
return dockerImage || "ERROR-NO-IMAGE-PROVIDED";
if (!dockerImage) {
return "ERROR-NO-IMAGE-PROVIDED";
}
// Don't modify if image already includes a registry URL
if (dockerImage.includes("/")) {
return dockerImage;
}
// Use registry.registryUrl or fallback to registryUrl
const registryHost = registry?.registryUrl || registryUrl;
if (registryHost) {
return join(registryHost, dockerImage);
}
return dockerImage;
}

if (registry) {
Expand Down

0 comments on commit 6aaef86

Please sign in to comment.