mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor(volumes): rework volumes and paths
This commit is contained in:
@@ -8,10 +8,7 @@ import { dirname, join } from "node:path";
|
||||
import { COMPOSE_PATH } from "@/server/constants";
|
||||
import type { InferResultType } from "@/server/types/with";
|
||||
import boxen from "boxen";
|
||||
import {
|
||||
generateFileMountsCompose,
|
||||
prepareEnvironmentVariables,
|
||||
} from "../docker/utils";
|
||||
import { prepareEnvironmentVariables } from "../docker/utils";
|
||||
import { spawnAsync } from "../process/spawnAsync";
|
||||
|
||||
export type ComposeNested = InferResultType<
|
||||
@@ -24,7 +21,6 @@ export const buildCompose = async (compose: ComposeNested, logPath: string) => {
|
||||
compose;
|
||||
try {
|
||||
const command = createCommand(compose);
|
||||
generateFileMountsCompose(appName, mounts);
|
||||
|
||||
createEnvFile(compose);
|
||||
|
||||
@@ -46,7 +42,7 @@ Compose Type: ${composeType} ✅`;
|
||||
});
|
||||
writeStream.write(`\n${logBox}\n`);
|
||||
|
||||
const projectPath = join(COMPOSE_PATH, compose.appName);
|
||||
const projectPath = join(COMPOSE_PATH, compose.appName, "code");
|
||||
await spawnAsync(
|
||||
"docker",
|
||||
[...command.split(" ")],
|
||||
@@ -104,8 +100,8 @@ export const createCommand = (compose: ComposeNested) => {
|
||||
const createEnvFile = (compose: ComposeNested) => {
|
||||
const { env, composePath, appName } = compose;
|
||||
const composeFilePath =
|
||||
join(COMPOSE_PATH, appName, composePath) ||
|
||||
join(COMPOSE_PATH, appName, "docker-compose.yml");
|
||||
join(COMPOSE_PATH, appName, "code", composePath) ||
|
||||
join(COMPOSE_PATH, appName, "code", "docker-compose.yml");
|
||||
|
||||
const envFilePath = join(dirname(composeFilePath), ".env");
|
||||
let envContent = env || "";
|
||||
|
||||
@@ -6,8 +6,7 @@ import { recreateDirectory } from "../filesystem/directory";
|
||||
|
||||
export const unzipDrop = async (zipFile: File, appName: string) => {
|
||||
try {
|
||||
const basePath = APPLICATIONS_PATH;
|
||||
const outputPath = join(basePath, appName);
|
||||
const outputPath = join(APPLICATIONS_PATH, appName, "code");
|
||||
await recreateDirectory(outputPath);
|
||||
const arrayBuffer = await zipFile.arrayBuffer();
|
||||
const buffer = Buffer.from(arrayBuffer);
|
||||
|
||||
@@ -11,6 +11,7 @@ export const buildNixpacks = async (
|
||||
) => {
|
||||
const { env, appName } = application;
|
||||
const buildAppDirectory = getBuildAppDirectory(application);
|
||||
|
||||
const envVariables = prepareEnvironmentVariables(env);
|
||||
try {
|
||||
const args = ["build", buildAppDirectory, "--name", appName];
|
||||
|
||||
Reference in New Issue
Block a user