Fix/compose build detection#5008
Open
amaan14999 wants to merge 2 commits into
Open
Conversation
|
Will this be available for next official release? Seems to be the blocker now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Change Summary
Fixes #4963.
Deploying an app configured with
[build.compose]was broken in two ways:Dockerfilehappened to be present,fly deploybuilt that and ignored the compose file entirely.Dockerfile, the deploy failed withapp does not have a Dockerfile or buildpacks configured- even when every compose service just referenced a pre-built image and needed no build at all.What and Why:
On every deploy, flyctl runs a single "build one image from source" step. That step only ever looked at the top-level
[build]config and, failing that, auto-detected aDockerfilein the working directory. It never read the compose file. So the "should we build, and from what?" decision and the compose file'sbuild:directive were completely disconnected - the build step didn't know compose existed.(For contrast, the machine-config-JSON path always designates exactly one container to build, so it always needs a Dockerfile. Compose is different: it may have one buildable service, or none at all. The old code treated both paths the same.)
How:
Connect the two. The deploy now reads the compose file to decide what to do:
build:section → nothing to build. Skip the source build and deploy each container with its own image. No more spurious Dockerfile builds, and no more "does not have a Dockerfile" error.build:section → build from that section'scontextanddockerfile, instead of guessing at a rootDockerfile.Both the shorthand (
build: ./dir) and long(build: { context:, dockerfile: }) compose forms are supported.Related to:
Documentation