mirror of
https://github.com/LukeHagar/dokploy.git
synced 2025-12-09 20:37:45 +00:00
fix(registry): add image tag resolution correctly when using cluster
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { createWriteStream } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { InferResultType } from "@dokploy/server/types/with";
|
||||
import type { CreateServiceOptions } from "dockerode";
|
||||
import { uploadImage } from "../cluster/upload";
|
||||
import { uploadImage, uploadImageRemoteCommand } from "../cluster/upload";
|
||||
import {
|
||||
calculateResources,
|
||||
generateBindMounts,
|
||||
@@ -69,19 +70,30 @@ export const getBuildCommand = (
|
||||
application: ApplicationNested,
|
||||
logPath: string,
|
||||
) => {
|
||||
const { buildType } = application;
|
||||
let command = "";
|
||||
const { buildType, registry } = application;
|
||||
switch (buildType) {
|
||||
case "nixpacks":
|
||||
return getNixpacksCommand(application, logPath);
|
||||
command = getNixpacksCommand(application, logPath);
|
||||
break;
|
||||
case "heroku_buildpacks":
|
||||
return getHerokuCommand(application, logPath);
|
||||
command = getHerokuCommand(application, logPath);
|
||||
break;
|
||||
case "paketo_buildpacks":
|
||||
return getPaketoCommand(application, logPath);
|
||||
command = getPaketoCommand(application, logPath);
|
||||
break;
|
||||
case "static":
|
||||
return getStaticCommand(application, logPath);
|
||||
command = getStaticCommand(application, logPath);
|
||||
break;
|
||||
case "dockerfile":
|
||||
return getDockerCommand(application, logPath);
|
||||
command = getDockerCommand(application, logPath);
|
||||
break;
|
||||
}
|
||||
if (registry) {
|
||||
command += uploadImageRemoteCommand(application, logPath);
|
||||
}
|
||||
|
||||
return command;
|
||||
};
|
||||
|
||||
export const mechanizeDockerContainer = async (
|
||||
@@ -186,11 +198,11 @@ const getImageName = (application: ApplicationNested) => {
|
||||
return dockerImage || "ERROR-NO-IMAGE-PROVIDED";
|
||||
}
|
||||
|
||||
const registryUrl = registry?.registryUrl || "";
|
||||
const imagePrefix = registry?.imagePrefix ? `${registry.imagePrefix}/` : "";
|
||||
return registry
|
||||
? `${registryUrl}/${imagePrefix}${appName}`
|
||||
: `${appName}:latest`;
|
||||
if (registry) {
|
||||
return join(registry.registryUrl, registry.imagePrefix || "", appName);
|
||||
}
|
||||
|
||||
return `${appName}:latest`;
|
||||
};
|
||||
|
||||
const getAuthConfig = (application: ApplicationNested) => {
|
||||
|
||||
Reference in New Issue
Block a user