From 27669adc21d6d28c952cabb6781935127976e191 Mon Sep 17 00:00:00 2001 From: Z User Date: Thu, 29 Oct 2026 13:00:54 +0000 Subject: [PATCH] fix: set buildType to dockerfile after creating Dokploy app + add saveBuildType MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dokploy defaults to 'nixpacks' build type which fails for repos with Dockerfile - Now provisioning flow: create → saveGithubProvider → saveBuildType(dockerfile) → saveEnvironment → deploy → createDomain - saveBuildType sets: buildType=dockerfile, dockerfile=Dockerfile, dockerContextPath=/ - This ensures the app builds correctly from the repo's Dockerfile --- src/lib/dokploy.ts | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/lib/dokploy.ts b/src/lib/dokploy.ts index 0bc295e..95d61b0 100644 --- a/src/lib/dokploy.ts +++ b/src/lib/dokploy.ts @@ -186,6 +186,30 @@ export function createDokployClient(config: DokployConfig) { }) } + async function saveBuildType(input: { + applicationId: string + buildType?: string + dockerfile?: string + dockerContextPath?: string + dockerBuildStage?: string + herokuVersion?: string + railpackVersion?: string + paketoBuilderImage?: string + paketoBuildpacks?: string[] + }): Promise { + await call('/application.saveBuildType', { + applicationId: input.applicationId, + buildType: input.buildType ?? 'dockerfile', + dockerfile: input.dockerfile ?? 'Dockerfile', + dockerContextPath: input.dockerContextPath ?? '/', + dockerBuildStage: input.dockerBuildStage ?? '', + herokuVersion: input.herokuVersion ?? '24', + railpackVersion: input.railpackVersion ?? 'latest', + paketoBuilderImage: input.paketoBuilderImage ?? '', + paketoBuildpacks: input.paketoBuildpacks ?? [], + }) + } + async function saveEnvironment(applicationId: string, envVars: Record): Promise { // Dokploy expects env as a .env-style string (KEY=value\nKEY2=value2) const envString = Object.entries(envVars) @@ -340,13 +364,21 @@ export function createDokployClient(config: DokployConfig) { }) } - // 3. Save environment variables + // 3. Set build type to Dockerfile (default is nixpacks which fails for many repos) + await saveBuildType({ + applicationId: app.applicationId, + buildType: 'dockerfile', + dockerfile: 'Dockerfile', + dockerContextPath: '/', + }) + + // 4. Save environment variables await saveEnvironment(app.applicationId, input.envVars) - // 4. Deploy + // 5. Deploy await deployApplication(app.applicationId) - // 5. Attach domain (optional — can be done later) + // 6. Attach domain (with HTTPS + Let's Encrypt) let domain: DokployDomain | undefined try { domain = await createDomain({ @@ -406,6 +438,7 @@ export function createDokployClient(config: DokployConfig) { saveGiteaProvider, saveGitProvider, saveGithubProvider, + saveBuildType, saveEnvironment, deployApplication, getApplication,