Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make build.context optional and default to . #376

Merged
merged 1 commit into from Jun 29, 2023

Conversation

ndeloof
Copy link
Collaborator

@ndeloof ndeloof commented Jun 28, 2023

What this PR does / why we need it:
make build.context optional and default to .

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Copy link
Contributor

@glours glours left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@milas milas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

This has been the behavior (unintentionally) of Compose v2.x all along, and nobody has complained about it...until we "fixed" it in v2.19, so I think this is a reasonable relaxing of strictness.

See also:

@ndeloof ndeloof merged commit 305289e into compose-spec:master Jun 29, 2023
2 checks passed
@danfundnel
Copy link

@ndeloof I may be wrong but it seems this change may have had some side-effects (not sure if intended) in the case where extends: is used to import compose specs from files in other dirs which specify a relative build.context path. Up until the 4.21 upgrade compose would take the reference in the included compose spec as relative to that file. It now seems to require it to be set relative to the directory docker-compose is called in (and, by the way, not the dir of the parent compose file using extends:, if that file is specified using -f). I think either behaviour is fine but this has broken the specs in our monorepo so I imagine others may also have to make this change.

@ndeloof ndeloof deleted the build_context branch July 6, 2023 07:57
@ndeloof
Copy link
Collaborator Author

ndeloof commented Jul 6, 2023

@danfundnel I don't think so
quick experiment:
compose.yaml

services:
  app:
    extends:
      file: ./abstract/base.yaml
      service: base

base.yaml

services:
  base:
    build:
      context: ./base
$ docker compose config
services:
  app:
    build:
      context: /Users/nicolas/test/abstract/base
      dockerfile: Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants