fix: Dockerfile ARGs and Nixpacks ARGs for preview builds #5909
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@andrasbacsai @peaklabs-dev
Please note i haven't tested this, but should give you an idea of what needs changing
There are 2 current issues regarding build ARGS
Since ARGS are scoped to the stage they are in, line 1 is usually a FROM command, so currently the ARGS are only valid in the inital stage and unavailable later when they are needed if it's a multi stage build
This is corrected by inserting them before any lines such that they are now globally scoped, as well as ensuring they remain in the same order this means later build args can now use values from a coolify build arg as this cant be done in a flag
(this could be a setting to enable/disable inserting build args, some users might not want their dockerfile changing)
This now sets the dockerfile to the created nixpacks dockerfile, and inserts the build args at the start
this should fix any env issues
p.s im unsure if the array lines are correct, but it's to ensure the env end up in the same order
thanks