Feature/fix compose multi stage builds #1530
Merged
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.
Fixes - #1433
The issue was that during our build pipeline we assumed an Image was used instead of a dockerfile, resulting in a
FROM empty string AS final
being added. The empty string came from the compose's devcontainer image name, which is nil since we are building the devcontainer.The fix was to assign the dockerFileContents to the read docker file if no modifications were made. Looking at
pkg/devcontainer/parse.go
line 223 we perform a check on the target and potentially return an empty string, as the dockerfile does not need to be modified. In this case we need to simply assign dockerFileContents to the variable containing the original dockerfile (line 450 inpkg/devcontainer/compose.go
).I also added 2 examples, one for multi stage builds and a compose. You can use these to validate the fix by seeing the OP's error running
devpod up examples/compose
then running the same with this PR's build.