mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
fix(logs): improve logs in remote server when is error, and fix the env parsing to allow any values in enviroment variables
This commit is contained in:
@@ -95,7 +95,7 @@ export const getDockerCommand = (
|
||||
command += createEnvFileCommand(dockerFilePath, env);
|
||||
}
|
||||
|
||||
command = `
|
||||
command += `
|
||||
echo "Building ${appName}" >> ${logPath};
|
||||
cd ${dockerContextPath} >> ${logPath} 2>> ${logPath} || {
|
||||
echo "❌ The path ${dockerContextPath} does not exist" >> ${logPath};
|
||||
|
||||
@@ -56,7 +56,7 @@ export const getHerokuCommand = (
|
||||
];
|
||||
|
||||
for (const env of envVariables) {
|
||||
args.push("--env", env);
|
||||
args.push("--env", `'${env}'`);
|
||||
}
|
||||
|
||||
const command = `pack ${args.join(" ")}`;
|
||||
|
||||
@@ -94,7 +94,7 @@ export const getNixpacksCommand = (
|
||||
const args = ["build", buildAppDirectory, "--name", appName];
|
||||
|
||||
for (const env of envVariables) {
|
||||
args.push("--env", env);
|
||||
args.push("--env", `'${env}'`);
|
||||
}
|
||||
|
||||
if (publishDirectory) {
|
||||
|
||||
@@ -55,7 +55,7 @@ export const getPaketoCommand = (
|
||||
];
|
||||
|
||||
for (const env of envVariables) {
|
||||
args.push("--env", env);
|
||||
args.push("--env", `'${env}'`);
|
||||
}
|
||||
|
||||
const command = `pack ${args.join(" ")}`;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join } from "node:path";
|
||||
import { prepareEnvironmentVariables } from "../docker/utils";
|
||||
import { encodeBase64, prepareEnvironmentVariables } from "../docker/utils";
|
||||
|
||||
export const createEnvFile = (directory: string, env: string | null) => {
|
||||
const envFilePath = join(dirname(directory), ".env");
|
||||
@@ -12,10 +12,10 @@ export const createEnvFile = (directory: string, env: string | null) => {
|
||||
};
|
||||
|
||||
export const createEnvFileCommand = (directory: string, env: string | null) => {
|
||||
const envFilePath = join(dirname(directory), ".env");
|
||||
if (!existsSync(dirname(envFilePath))) {
|
||||
mkdirSync(dirname(envFilePath), { recursive: true });
|
||||
}
|
||||
const envFileContent = prepareEnvironmentVariables(env).join("\n");
|
||||
return `echo "${envFileContent}" > ${envFilePath}`;
|
||||
|
||||
const encodedContent = encodeBase64(envFileContent || "");
|
||||
const envFilePath = join(dirname(directory), ".env");
|
||||
|
||||
return `echo "${encodedContent}" | base64 -d > "${envFilePath}";`;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user