Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
import { CheckIcon, ChevronsUpDown, X } from "lucide-react";
import { CheckIcon, ChevronsUpDown, HelpCircle, X } from "lucide-react";
import Link from "next/link";
import { useEffect } from "react";
import { useForm } from "react-hook-form";
Expand Down Expand Up @@ -51,6 +51,7 @@ import { api } from "@/utils/api";

const BitbucketProviderSchema = z.object({
composePath: z.string().min(1),
composeWorkingDir: z.string().optional(),
repository: z
.object({
repo: z.string().min(1, "Repo is required"),
Expand Down Expand Up @@ -84,6 +85,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
const form = useForm({
defaultValues: {
composePath: "./docker-compose.yml",
composeWorkingDir: "",
repository: {
owner: "",
repo: "",
Expand Down Expand Up @@ -141,6 +143,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
slug: data.bitbucketRepositorySlug || "",
},
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir || "",
bitbucketId: data.bitbucketId || "",
watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
Expand All @@ -156,6 +159,7 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
bitbucketOwner: data.repository.owner,
bitbucketId: data.bitbucketId,
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir ?? "",
composeId,
sourceType: "bitbucket",
composeStatus: "idle",
Expand Down Expand Up @@ -413,6 +417,43 @@ export const SaveBitbucketProviderCompose = ({ composeId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="composeWorkingDir"
render={({ field }) => (
<FormItem>
<div className="flex items-center gap-2">
<FormLabel>Working Directory</FormLabel>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" />
</TooltipTrigger>
<TooltipContent className="max-w-[320px]">
<p>
Optional subdirectory (relative to the repository
root) from which docker compose will be launched.
Useful when the compose file relies on a local .env,
build contexts or volumes that are colocated inside
a subfolder. Leave empty to run from the repository
root.
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<FormControl>
<Input
placeholder="e.g. apps/my-app"
{...field}
value={field.value ?? ""}
/>
</FormControl>

<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="watchPaths"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import { api } from "@/utils/api";

const GitProviderSchema = z.object({
composePath: z.string().min(1),
composeWorkingDir: z.string().optional(),
repositoryURL: z.string().min(1, {
message: "Repository URL is required",
}),
Expand Down Expand Up @@ -69,6 +70,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
branch: "",
repositoryURL: "",
composePath: "./docker-compose.yml",
composeWorkingDir: "",
sshKey: undefined,
watchPaths: [],
enableSubmodules: false,
Expand All @@ -83,6 +85,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
branch: data.customGitBranch || "",
repositoryURL: data.customGitUrl || "",
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir || "",
watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
});
Expand All @@ -97,6 +100,7 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
composeId,
sourceType: "git",
composePath: values.composePath,
composeWorkingDir: values.composeWorkingDir ?? "",
composeStatus: "idle",
watchPaths: values.watchPaths || [],
enableSubmodules: values.enableSubmodules,
Expand Down Expand Up @@ -225,6 +229,43 @@ export const SaveGitProviderCompose = ({ composeId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="composeWorkingDir"
render={({ field }) => (
<FormItem>
<div className="flex items-center gap-2">
<FormLabel>Working Directory</FormLabel>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" />
</TooltipTrigger>
<TooltipContent className="max-w-[320px]">
<p>
Optional subdirectory (relative to the repository
root) from which docker compose will be launched.
Useful when the compose file relies on a local .env,
build contexts or volumes that are colocated inside a
subfolder. Leave empty to run from the repository
root.
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<FormControl>
<Input
placeholder="e.g. apps/my-app"
{...field}
value={field.value ?? ""}
/>
</FormControl>

<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="watchPaths"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import type { Repository } from "@/utils/gitea-utils";

const GiteaProviderSchema = z.object({
composePath: z.string().min(1),
composeWorkingDir: z.string().optional(),
repository: z
.object({
repo: z.string().min(1, "Repo is required"),
Expand Down Expand Up @@ -82,6 +83,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
const form = useForm({
defaultValues: {
composePath: "./docker-compose.yml",
composeWorkingDir: "",
repository: {
owner: "",
repo: "",
Expand Down Expand Up @@ -141,6 +143,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
owner: data.giteaOwner || "",
},
composePath: data.composePath || "./docker-compose.yml",
composeWorkingDir: data.composeWorkingDir || "",
giteaId: data.giteaId || "",
watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
Expand All @@ -154,6 +157,7 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
giteaRepository: data.repository.repo,
giteaOwner: data.repository.owner,
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir ?? "",
giteaId: data.giteaId,
composeId,
sourceType: "gitea",
Expand Down Expand Up @@ -404,6 +408,43 @@ export const SaveGiteaProviderCompose = ({ composeId }: Props) => {
)}
/>

<FormField
control={form.control}
name="composeWorkingDir"
render={({ field }) => (
<FormItem>
<div className="flex items-center gap-2">
<FormLabel>Working Directory</FormLabel>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" />
</TooltipTrigger>
<TooltipContent className="max-w-[320px]">
<p>
Optional subdirectory (relative to the repository
root) from which docker compose will be launched.
Useful when the compose file relies on a local .env,
build contexts or volumes that are colocated inside
a subfolder. Leave empty to run from the repository
root.
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<FormControl>
<Input
placeholder="e.g. apps/my-app"
{...field}
value={field.value ?? ""}
/>
</FormControl>
<FormMessage />
</FormItem>
)}
/>

<FormField
control={form.control}
name="watchPaths"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { api } from "@/utils/api";

const GithubProviderSchema = z.object({
composePath: z.string().min(1),
composeWorkingDir: z.string().optional(),
repository: z
.object({
repo: z.string().min(1, "Repo is required"),
Expand Down Expand Up @@ -82,6 +83,7 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
const form = useForm({
defaultValues: {
composePath: "./docker-compose.yml",
composeWorkingDir: "",
repository: {
owner: "",
repo: "",
Expand Down Expand Up @@ -132,6 +134,7 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
owner: data.owner || "",
},
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir || "",
githubId: data.githubId || "",
watchPaths: data.watchPaths || [],
triggerType: data.triggerType || "push",
Expand All @@ -147,6 +150,7 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
composeId,
owner: data.repository.owner,
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir ?? "",
githubId: data.githubId,
sourceType: "github",
composeStatus: "idle",
Expand Down Expand Up @@ -399,6 +403,43 @@ export const SaveGithubProviderCompose = ({ composeId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="composeWorkingDir"
render={({ field }) => (
<FormItem>
<div className="flex items-center gap-2">
<FormLabel>Working Directory</FormLabel>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" />
</TooltipTrigger>
<TooltipContent className="max-w-[320px]">
<p>
Optional subdirectory (relative to the repository
root) from which docker compose will be launched.
Useful when the compose file relies on a local .env,
build contexts or volumes that are colocated inside
a subfolder. Leave empty to run from the repository
root.
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<FormControl>
<Input
placeholder="e.g. apps/my-app"
{...field}
value={field.value ?? ""}
/>
</FormControl>

<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="triggerType"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { VALID_BRANCH_REGEX } from "@dokploy/server/utils/git-branch-validation";
import { standardSchemaResolver as zodResolver } from "@hookform/resolvers/standard-schema";
import { CheckIcon, ChevronsUpDown, X } from "lucide-react";
import { CheckIcon, ChevronsUpDown, HelpCircle, X } from "lucide-react";
import Link from "next/link";
import { useEffect, useMemo } from "react";
import { useForm } from "react-hook-form";
Expand Down Expand Up @@ -51,6 +51,7 @@ import { api } from "@/utils/api";

const GitlabProviderSchema = z.object({
composePath: z.string().min(1),
composeWorkingDir: z.string().optional(),
repository: z
.object({
repo: z.string().min(1, "Repo is required"),
Expand Down Expand Up @@ -84,6 +85,7 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
const form = useForm({
defaultValues: {
composePath: "./docker-compose.yml",
composeWorkingDir: "",
repository: {
owner: "",
repo: "",
Expand Down Expand Up @@ -151,6 +153,7 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
gitlabPathNamespace: data.gitlabPathNamespace || "",
},
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir || "",
gitlabId: data.gitlabId || "",
watchPaths: data.watchPaths || [],
enableSubmodules: data.enableSubmodules ?? false,
Expand All @@ -164,6 +167,7 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
gitlabRepository: data.repository.repo,
gitlabOwner: data.repository.owner,
composePath: data.composePath,
composeWorkingDir: data.composeWorkingDir ?? "",
gitlabId: data.gitlabId,
composeId,
gitlabProjectId: data.repository.id,
Expand Down Expand Up @@ -431,6 +435,43 @@ export const SaveGitlabProviderCompose = ({ composeId }: Props) => {
</FormItem>
)}
/>
<FormField
control={form.control}
name="composeWorkingDir"
render={({ field }) => (
<FormItem>
<div className="flex items-center gap-2">
<FormLabel>Working Directory</FormLabel>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<HelpCircle className="size-4 text-muted-foreground hover:text-foreground transition-colors cursor-pointer" />
</TooltipTrigger>
<TooltipContent className="max-w-[320px]">
<p>
Optional subdirectory (relative to the repository
root) from which docker compose will be launched.
Useful when the compose file relies on a local .env,
build contexts or volumes that are colocated inside
a subfolder. Leave empty to run from the repository
root.
</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
</div>
<FormControl>
<Input
placeholder="e.g. apps/my-app"
{...field}
value={field.value ?? ""}
/>
</FormControl>

<FormMessage />
</FormItem>
)}
/>
<FormField
control={form.control}
name="watchPaths"
Expand Down
1 change: 1 addition & 0 deletions apps/dokploy/drizzle/0172_silky_maestro.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE "compose" ADD COLUMN "composeWorkingDir" text DEFAULT '' NOT NULL;
Loading