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

bake: fix compose consistency check #1181

Merged
merged 1 commit into from
Jun 23, 2022

Conversation

crazy-max
Copy link
Member

fixes #1172

Consistency check added in #87 is already handled by the library: https://github.com/compose-spec/compose-go/blob/c45b40b31e66dbc3966642803d133bba33680b21/loader/validate.go#L31-L33

Since we have moved to the compose-go library, we can skip the consistency check, remove the dup check in bake as well and use our own "less-strict" consistency check in bake to be aligned with the HCL format:

# docker-compose.yml
services:
  test:
    build:
      context: .
      tags:
        - docker.io/username/webapp:latest
    entrypoint: echo 1
# docker-compose.prod.yml
services:
  test:
    entrypoint: echo 2
$ docker buildx bake -f docker-compose.yml test --print
{
  "group": {
    "default": {
      "targets": [
        "test"
      ]
    }
  },
  "target": {
    "test": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "tags": [
        "docker.io/username/webapp:latest"
      ]
    }
  }
}
$ docker buildx bake -f docker-compose.prod.yml test --print
{
  "group": {
    "default": {
      "targets": [
        "test"
      ]
    }
  },
  "target": {
    "test": {
      "context": ".",
      "dockerfile": "Dockerfile"
    }
  }
}
$ docker buildx bake -f docker-compose.yml -f docker-compose.prod.yml test --print
{
  "group": {
    "default": {
      "targets": [
        "test"
      ]
    }
  },
  "target": {
    "test": {
      "context": ".",
      "dockerfile": "Dockerfile",
      "tags": [
        "docker.io/username/webapp:latest"
      ]
    }
  }
}

Signed-off-by: CrazyMax [email protected]

@crazy-max crazy-max force-pushed the compose-consistency branch 2 times, most recently from b2dfb31 to f0db494 Compare June 23, 2022 11:06
@tonistiigi tonistiigi merged commit 3cf549a into docker:master Jun 23, 2022
@crazy-max crazy-max deleted the compose-consistency branch June 23, 2022 16:51
@crazy-max crazy-max added this to the v0.9.0 milestone Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to use multiple build definition files with bake
3 participants