diff --git a/apps/dokploy/components/dashboard/application/advanced/show-build-server.tsx b/apps/dokploy/components/dashboard/application/advanced/show-build-server.tsx index caa2b8e35..545a5f705 100644 --- a/apps/dokploy/components/dashboard/application/advanced/show-build-server.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/show-build-server.tsx @@ -38,10 +38,31 @@ interface Props { applicationId: string; } -const schema = z.object({ - buildServerId: z.string().min(1, "Build server is required"), - buildRegistryId: z.string().min(1, "Build registry is required"), -}); +const schema = z + .object({ + buildServerId: z.string().optional(), + buildRegistryId: z.string().optional(), + }) + .refine( + (data) => { + // Both empty/none is valid + const buildServerIsNone = + !data.buildServerId || data.buildServerId === "none"; + const buildRegistryIsNone = + !data.buildRegistryId || data.buildRegistryId === "none"; + + // Both should be either filled or empty + if (buildServerIsNone && buildRegistryIsNone) return true; + if (!buildServerIsNone && !buildRegistryIsNone) return true; + + return false; + }, + { + message: + "Both Build Server and Build Registry must be selected together, or both set to None", + path: ["buildServerId"], // Show error on buildServerId field + }, + ); type Schema = z.infer; @@ -121,6 +142,11 @@ export const ShowBuildServer = ({ applicationId }: Props) => { container starts running. + + Note: Build Server and Build Registry must be + configured together. You can either select both or set both to None. + + {!registries || registries.length === 0 ? ( You need to add at least one registry to use build servers. Please @@ -147,7 +173,13 @@ export const ShowBuildServer = ({ applicationId }: Props) => { Build Server { + field.onChange(value); + // If setting to "none", also reset build server to "none" + if (value === "none") { + form.setValue("buildServerId", "none"); + } + }} value={field.value || "none"} > diff --git a/apps/dokploy/components/dashboard/projects/show.tsx b/apps/dokploy/components/dashboard/projects/show.tsx index 5f7469050..9ce42c1a0 100644 --- a/apps/dokploy/components/dashboard/projects/show.tsx +++ b/apps/dokploy/components/dashboard/projects/show.tsx @@ -286,13 +286,17 @@ export const ShowProjects = () => { ) .some(Boolean); + const productionEnvironment = project?.environments.find( + (env) => env.isDefault, + ); + return (
{haveServicesWithDomains ? (