MCPcopy
hub / github.com/Dokploy/dokploy / generateConfigContainer

Function generateConfigContainer

packages/server/src/utils/docker/utils.ts:538–638  ·  view source on GitHub ↗
(
	application: Partial<ApplicationNested>,
)

Source from the content-addressed store, hash-verified

536};
537
538export const generateConfigContainer = (
539 application: Partial<ApplicationNested>,
540) => {
541 const {
542 healthCheckSwarm,
543 restartPolicySwarm,
544 placementSwarm,
545 updateConfigSwarm,
546 rollbackConfigSwarm,
547 modeSwarm,
548 labelsSwarm,
549 replicas,
550 mounts,
551 networkSwarm,
552 stopGracePeriodSwarm,
553 endpointSpecSwarm,
554 ulimitsSwarm,
555 } = application;
556
557 const haveMounts = mounts && mounts.length > 0;
558
559 return {
560 ...(healthCheckSwarm && {
561 HealthCheck: healthCheckSwarm,
562 }),
563 ...(restartPolicySwarm && {
564 RestartPolicy: restartPolicySwarm,
565 }),
566 ...(placementSwarm
567 ? {
568 Placement: placementSwarm,
569 }
570 : {
571 // if app have mounts keep manager as constraint
572 Placement: {
573 Constraints: haveMounts ? ["node.role==manager"] : [],
574 },
575 }),
576 ...(labelsSwarm && {
577 Labels: labelsSwarm,
578 }),
579 ...(modeSwarm
580 ? {
581 Mode: modeSwarm,
582 }
583 : {
584 // use replicas value if no modeSwarm provided
585 Mode: {
586 Replicated: {
587 Replicas: replicas,
588 },
589 },
590 }),
591 ...(rollbackConfigSwarm
592 ? { RollbackConfig: rollbackConfigSwarm }
593 : {
594 // default rollback config to match update config
595 RollbackConfig: {

Callers 8

mechanizeDockerContainerFunction · 0.90
buildMysqlFunction · 0.90
buildMongoFunction · 0.90
buildRedisFunction · 0.90
buildLibsqlFunction · 0.90
buildPostgresFunction · 0.90
buildMariadbFunction · 0.90
rollbackApplicationFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected