dokploy icon indicating copy to clipboard operation
dokploy copied to clipboard

Custom build server

Open egoist opened this issue 1 year ago • 17 comments

What problem will this feature address?

The build process runs on the same server as my projects, which isn't ideal

Describe the solution you'd like

Use a separate server to build the projects

Describe alternatives you've considered

I can offload that build process to GitHub Actions, but it's extra effort, and it's not free

Additional context

This concept exists in Coolify https://coolify.io/docs/knowledge-base/server/build-server

egoist avatar Nov 17 '24 15:11 egoist

We could plan it, I think it wouldn't be that difficult to implement, it's just that it would only be available for applications.

Siumauricio avatar Nov 17 '24 15:11 Siumauricio

This would be a nice feature. any update on this ?

i could help develop this if it's ok i am new to contributing

ihsanhere avatar Mar 25 '25 10:03 ihsanhere

I agree it would be very cool to have

rubymignot avatar Mar 28 '25 21:03 rubymignot

This would be such a valuable feature, reduces costs by a lot for Next.js as they currently require 4GB RAM to build.

xndyz avatar May 28 '25 13:05 xndyz

I think, move the build process to a container will help to safeguard the server.

By running builds in containers, you can set CPU and memory limits, which prevents the build from consuming more resources than intended and keeps the applications isolated from build workload spikes. This approach also makes builds more reproducible and portable.

And as a bonus, any external server with the docker engine can be used as a building server.

HBeserra avatar Jul 03 '25 16:07 HBeserra

+1, This could really improve the multi/remote-server setup!

TinusNL avatar Jul 24 '25 19:07 TinusNL

I start to looking in the dokploy code base, the build process retrieves application info, creates a deployment record, runs remote build commands(if needed), manages the Docker container and updates statuses.

https://github.com/Dokploy/dokploy/blob/b95dfed8fc49cb916cd42d1ca87884963ba475c3/packages/server/src/services/application.ts#L624-L670

getBuildCommand acts as a dispatcher that builds the correct shell command for the application, supporting multiple build systems(Dockerfile, buildpacks, static, etc.) and handling image uploads when a registry is involved.The returned command string is then executed remotely as part of the deployment process.

https://github.com/Dokploy/dokploy/blob/b95dfed8fc49cb916cd42d1ca87884963ba475c3/packages/server/src/utils/builders/index.ts#L79-L110

I'm thinking to create a wrapper function for the build command


  function rebuildRemoteApplication(...)
      // ...existing code...
      if (application.serverId) {
        if (application.sourceType !== "docker") {
          let command = "set -e;";
          command += getBuildCommand(application, deployment.logPath);
    
          if (buildInDocker) {
            const dockerCmd = `
              docker run --rm \
                -v ${<repositoryPath>}:/app \
                -w /app \
                <build-image> \
                bash -c "${command.replace(/"/g, '\\"')}"
            `;
            command = dockerCmd;
          }
        // ...existing code...

HBeserra avatar Jul 29 '25 16:07 HBeserra

@Siumauricio, do you have any updates on this?

I believe this feature would bring the true power of Dockploy into production use. Having the build on the production server isn't the best practice, and creating GitHub Actions undermines the significant advantage of auto-deploy.

I'm eagerly waiting for this feature to consider Dockploy as the first choice for production servers.

aronbraun avatar Sep 17 '25 17:09 aronbraun

@Siumauricio, this feature is an absolute must-have for me. When my Docker build is running, the applications go down, because the build takes all resources. It would be much cheaper to have one beefy build server and several cheap application servers than scaling the app servers so they also can handle the build.

maoberlehner avatar Oct 10 '25 21:10 maoberlehner

any plan?

cottom avatar Oct 15 '25 19:10 cottom

+1, somebody please do this!

st-karki avatar Oct 16 '25 06:10 st-karki

+1, would love this feature

th2design avatar Oct 21 '25 22:10 th2design

@Siumauricio I would like to work on this.

But no point on starting if the task is already in progress by any other members. Can you tell if its in progress or not started?

shreekrishnalamichhane avatar Oct 26 '25 08:10 shreekrishnalamichhane

+1

JunxuanB avatar Oct 27 '25 18:10 JunxuanB

If you have time to work on this I'm open to accept this! @shreekrishnalamichhane

Siumauricio avatar Nov 03 '25 06:11 Siumauricio

+1

adrianvazquezbarrera avatar Nov 03 '25 09:11 adrianvazquezbarrera

+1

TurboBez avatar Nov 18 '25 10:11 TurboBez

Custom Build is finally finished!!

https://github.com/Dokploy/dokploy/pull/3138 In the next minor version should be available 😃

Siumauricio avatar Nov 30 '25 05:11 Siumauricio

It only took 1year to get this done. But in the end it was done. I love open source

RukshanJS avatar Dec 07 '25 16:12 RukshanJS

When my Docker build is running, the applications go down, because the build takes all resources.

Have you heard of the "nice" command yet? Did anyone ever use it to build on production server? Just curious if it works as intended or if it's a dead end.

StohanzlMart avatar Dec 14 '25 10:12 StohanzlMart