fix: set buildType to dockerfile after creating Dokploy app + add saveBuildType
- 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
This commit is contained in:
1 parent
7e458ae698
commit
27669adc21
1 file changed
+36
-3
+36
-3
@@ -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<void> {
|
||||
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<string, string>): Promise<void> {
|
||||
// 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,
|
||||
|
||||
Reference in new issue
Block a user