Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Merge branch 'next' into feat-add-dockerfile-from-instruction-par

Andras Bacsaid0ee7d041248
diff --cc app/Jobs/ApplicationDeploymentJob.php
index 1dfcaaafce,08a6aa9ccc..ea8cdff954
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@@ -3310,20 -3288,12 +3310,19 @@@ COPY ./nginx.conf /etc/nginx/conf.d/def
}
}
- // Add secrets hash if we have environment variables
-- if ($envs->isNotEmpty()) {
- $secrets_hash = $this->generate_secrets_hash($envs);
- $argsToInsert->push("ARG COOLIFY_BUILD_SECRETS_HASH={$secrets_hash}");
- }
-
+ // Insert ARGs after each FROM instruction (in reverse order to maintain correct line numbers)
+ if ($argsToInsert->isNotEmpty()) {
+ foreach (array_reverse($fromLines) as $fromLineIndex) {
+ // Insert all ARGs after this FROM instruction
+ foreach ($argsToInsert->reverse() as $arg) {
+ $dockerfile->splice($fromLineIndex + 1, 0, [$arg]);
+ }
+ }
+ $envs_mapped = $envs->mapWithKeys(function ($env) {
+ return [$env->key => $env->real_value];
+ });
+ $secrets_hash = $this->generate_secrets_hash($envs_mapped);
- $dockerfile->splice(1, 0, ["ARG COOLIFY_BUILD_SECRETS_HASH={$secrets_hash}"]);
++ $argsToInsert->push("ARG COOLIFY_BUILD_SECRETS_HASH={$secrets_hash}");
}
$dockerfile_base64 = base64_encode($dockerfile->implode("\n"));