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

Doesn't work with Dockerfile.* #6

Open
b0o opened this issue Jun 17, 2023 · 1 comment · May be fixed by #18
Open

Doesn't work with Dockerfile.* #6

b0o opened this issue Jun 17, 2023 · 1 comment · May be fixed by #18

Comments

@b0o
Copy link

b0o commented Jun 17, 2023

When there's a need to have multiple Dockerfiles in a single directory, it's relatively common to name them Dockerfile.*, e.g. Dockerfile.dev, Dockerfile.prod.

I've tried configuring dprint to match such files, but it doesn't seem to work:

{
  "dockerfile": {},
  "includes": [
    "**/Dockerfile",
    "**/Dockerfile.*"
  ],
  "excludes": [],
  "plugins": [
    "https://plugins.dprint.dev/dockerfile-0.3.0.wasm"
  ]
}

If I have Dockerfile and Dockerfile.prod at the root of my project, running dprint output-file-paths finds Dockerfile but not Dockerfile.prod. It doesn't even work if I explicitly add **/Dockerfile.prod to includes.

If I add **/*.Dockerfile to includes and mv Dockerfile.prod prod.Dockerfile, it does find the file, but this isn't our preferred naming convention.

dprint-plugin-dockerfile version: 0.3.0

@UnknownPlatypus
Copy link

@b0o I believe you can simply add an association key to your config to make dprint format files matching your specific glob with the docker plugin.

{
  "dockerfile": {
    "associations": ["**/Dockerfile.*"]
  },
  "excludes": [],
  "plugins": [
    "https://plugins.dprint.dev/dockerfile-0.3.0.wasm"
  ]
}

scop added a commit to scop/dprint-plugin-dockerfile that referenced this issue Jan 8, 2025
This convention used to be noted in the Docker documentation for some
time recently, and has stuck here and there even though the docs no
longer refer to it.

docker/docs#9245 (comment)

Closes dprint#6
@scop scop linked a pull request Jan 8, 2025 that will close this issue
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 a pull request may close this issue.

2 participants