mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #963 from Dokploy/540-need-more-control-over-docker-compose-command-in-deployments
540 need more control over docker compose command in deployments
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import { AlertBlock } from "@/components/shared/alert-block";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
@@ -91,7 +92,7 @@ export const AddCommandCompose = ({ composeId }: Props) => {
|
|||||||
<div>
|
<div>
|
||||||
<CardTitle className="text-xl">Run Command</CardTitle>
|
<CardTitle className="text-xl">Run Command</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
Append a custom command to the compose file
|
Override a custom command to the compose file
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</div>
|
</div>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
@@ -101,6 +102,12 @@ export const AddCommandCompose = ({ composeId }: Props) => {
|
|||||||
onSubmit={form.handleSubmit(onSubmit)}
|
onSubmit={form.handleSubmit(onSubmit)}
|
||||||
className="grid w-full gap-4"
|
className="grid w-full gap-4"
|
||||||
>
|
>
|
||||||
|
<AlertBlock type="warning">
|
||||||
|
Modifying the default command may affect deployment stability,
|
||||||
|
impacting logs and monitoring. Proceed carefully and test
|
||||||
|
thoroughly. By default, the command starts with{" "}
|
||||||
|
<strong>docker</strong>.
|
||||||
|
</AlertBlock>
|
||||||
<div className="flex flex-col gap-4">
|
<div className="flex flex-col gap-4">
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ Compose Type: ${composeType} ✅`;
|
|||||||
writeStream.write(`\n${logBox}\n`);
|
writeStream.write(`\n${logBox}\n`);
|
||||||
|
|
||||||
const projectPath = join(COMPOSE_PATH, compose.appName, "code");
|
const projectPath = join(COMPOSE_PATH, compose.appName, "code");
|
||||||
|
|
||||||
await spawnAsync(
|
await spawnAsync(
|
||||||
"docker",
|
"docker",
|
||||||
[...command.split(" ")],
|
[...command.split(" ")],
|
||||||
@@ -144,6 +145,10 @@ const sanitizeCommand = (command: string) => {
|
|||||||
export const createCommand = (compose: ComposeNested) => {
|
export const createCommand = (compose: ComposeNested) => {
|
||||||
const { composeType, appName, sourceType } = compose;
|
const { composeType, appName, sourceType } = compose;
|
||||||
|
|
||||||
|
if (compose.command) {
|
||||||
|
return `${sanitizeCommand(compose.command)}`;
|
||||||
|
}
|
||||||
|
|
||||||
const path =
|
const path =
|
||||||
sourceType === "raw" ? "docker-compose.yml" : compose.composePath;
|
sourceType === "raw" ? "docker-compose.yml" : compose.composePath;
|
||||||
let command = "";
|
let command = "";
|
||||||
@@ -154,12 +159,6 @@ export const createCommand = (compose: ComposeNested) => {
|
|||||||
command = `stack deploy -c ${path} ${appName} --prune`;
|
command = `stack deploy -c ${path} ${appName} --prune`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const customCommand = sanitizeCommand(compose.command);
|
|
||||||
|
|
||||||
if (customCommand) {
|
|
||||||
command = `${command} ${customCommand}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
return command;
|
return command;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user