feat: buildServerId + Docker image support for preview deployments#3784
Draft
kopandante wants to merge 2 commits intoDokploy:canaryfrom
Draft
feat: buildServerId + Docker image support for preview deployments#3784kopandante wants to merge 2 commits intoDokploy:canaryfrom
kopandante wants to merge 2 commits intoDokploy:canaryfrom
Conversation
…ments Preview deployments now correctly use `buildServerId` (falling back to `serverId`) for build execution, log paths and deployment records -- matching the existing production `deployApplication` behavior. Additionally, preview deployments can now be created from pre-built Docker images via the new `deployFromImage` tRPC procedure, enabling external CI/CD pipelines (GitHub Actions, etc.) to push images and trigger preview deployments without building on the Dokploy server. Changes: - deployment.ts: resolve buildServerId for paths/exec/record - application.ts: handle docker sourceType in deploy/rebuild preview - preview-deployment.ts: extract preparePreview/insertAndConfigurePreview helpers, add createPreviewDeploymentFromImage - preview-deployments schema: add dockerImage column and Zod schema - router: add deployFromImage procedure with auth + BullMQ queue
Comment on lines
168
to
172
| await removeLastTenDeployments( | ||
| deployment.previewDeploymentId, | ||
| "previewDeployment", | ||
| previewDeployment?.application?.serverId, | ||
| ); |
Contributor
There was a problem hiding this comment.
still passing application.serverId instead of buildServerId to cleanup old logs
Suggested change
| await removeLastTenDeployments( | |
| deployment.previewDeploymentId, | |
| "previewDeployment", | |
| previewDeployment?.application?.serverId, | |
| ); | |
| await removeLastTenDeployments( | |
| deployment.previewDeploymentId, | |
| "previewDeployment", | |
| buildServerId, | |
| ); |
This was referenced Feb 23, 2026
…ld server When an application uses a separate build server (buildServerId != serverId), the build registry is needed to push the built image so the deploy server can pull it. Preview deployments were unconditionally nulling buildRegistry, which broke the image push and Swarm auth for external build server setups. Now buildRegistry is only nulled when there is no separate build server (matching how regular deployApplication works). Also fix dockerode createService auth: pass authconfig as first argument since createService(opts) doesn't auto-extract it (unlike service.update).
4bd5bb4 to
23fcb37
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Preview deployments fail when using a separate build server (
buildServerId != serverId) with a build registry.Both
deployPreviewApplicationandrebuildPreviewApplicationunconditionally nullbuildRegistry:This breaks the entire image delivery pipeline:
getBuildCommand()skipsuploadImageRemoteCommand()— image never pushed to registrygetImageName()returns local name (appName:latest) instead of registry taggetAuthConfig()returnsundefined— no auth for Docker Swarm to pullRegular
deployApplicationworks correctly because it never nullsbuildRegistry.Fix
application.ts: Only null
buildRegistrywhen there's no separate build server:This preserves the original behavior for same-server deployments while enabling the registry pipeline for external build servers — matching exactly how
deployApplicationhandles it.builders/index.ts: Fix
createServiceauth inmechanizeDockerContainer:service.update()auto-extractsopts.authconfig, butcreateService()does not when called with a single argument — this is an existing dockerode inconsistency.Test plan
buildServerIddifferent fromserverIdandbuildRegistryconfigured