Live data from Hacker News

Dockerfmt: A Dockerfile Formatter

github.com

61–67 of 67 posts

Re: Dockerfmt: A Dockerfile Formatter

#61
post #58

I don't want to vouch for the flagged and dead comment https://news.ycombinator.com/item?id=43630653 because I suspect it was killed for its tone but wow it is really illustrative of the QA that didn't go into this product

What I can do for you is fix the bugs promptly! I resolved the bugs in the `0.2.7` release. I haven't graduated college yet and don't have a full time job, so my QA skills are still improving.

Re: Dockerfmt: A Dockerfile Formatter

#62
post #38

Earlier quoted context omitted.

Or, you can write an actual shell script file (i.e. with a .sh extension) to be stored in your repository, ADD it in a throwaway context (i.e. multi-stage builds), then RUN --mount=type=bind to put it into a temporary directory in the build container so that you can execute it. This way, the script doesn't pollute the container, and you have proper separation of concerns, including the ability to use library function…

That's bad practice because it hides build steps from `docker inspect`. Per https://github.com/docker-library/official-images#clarity : > Try to make the Dockerfile easy to understand/read. It may be tempting, for the sake of brevity, to put complicated initialization details into a standalone script and merely add a RUN command in the Dockerfile. However, this causes the resulting Dockerfile to be overly opaque, and…

Don't multi-stage builds already break `docker inspect`?

Re: Dockerfmt: A Dockerfile Formatter

#63

Earlier quoted context omitted.

Hi there — I’ll try to distribute a docker release of the binary tomorrow!

I think they were asking for a sample Dockerfile in the repo to test it on.

Then they can use one of the 14 in the `tests` directory :) https://github.com/reteps/dockerfmt/tree/main/tests

Re: Dockerfmt: A Dockerfile Formatter

#64

[flagged]

In the spirit of constructive feedback, I filed an issue for you: https://github.com/reteps/dockerfmt/issues/18

I fixed this in the 0.2.8 release https://github.com/reteps/dockerfmt/releases/tag/0.2.8.

Relevant reading about the `&&` normalization. https://pkg.go.dev/encoding/json#Marshal

Re: Dockerfmt: A Dockerfile Formatter

#65
post #38

Earlier quoted context omitted.

Or, you can write an actual shell script file (i.e. with a .sh extension) to be stored in your repository, ADD it in a throwaway context (i.e. multi-stage builds), then RUN --mount=type=bind to put it into a temporary directory in the build container so that you can execute it. This way, the script doesn't pollute the container, and you have proper separation of concerns, including the ability to use library function…

That's bad practice because it hides build steps from `docker inspect`. Per https://github.com/docker-library/official-images#clarity : > Try to make the Dockerfile easy to understand/read. It may be tempting, for the sake of brevity, to put complicated initialization details into a standalone script and merely add a RUN command in the Dockerfile. However, this causes the resulting Dockerfile to be overly opaque, and…

That's advice specifically for official images, and it dates back before multi-stage builds. Most people are not building official images. Most people benefit from clear encapsulation and separation of concerns. The Dockerfile sets up the environment to run the provisioning script, and a provisioning script does the actual provisioning. Official images are different because usually the provisioning script is hidden in an OS package installed with e.g. apk add (or are we going to pretend that OS packages are bad practice for the same reason?).

Re: Dockerfmt: A Dockerfile Formatter

#66

[flagged]

In the spirit of constructive feedback, I filed an issue for you: https://github.com/reteps/dockerfmt/issues/18 I fixed this in the 0.2.8 release https://github.com/reteps/dockerfmt/releases/tag/0.2.8 . Relevant reading about the `&&` normalization. https://pkg.go.dev/encoding/json#Marshal

It's still wrong, and I don't know how I could explain it more completely:

  -ENTRYPOINT service ssh restart && bash
  +ENTRYPOINT ["service", "ssh", "restart", "&&", "bash"]
You should read and understand the documentation for the containerfile format before continuing. This isn't some quirk because i'm using &&, you are breaking almost every dockerfile that doesn't use the array syntax for ENTRYPOINT.

Re: Dockerfmt: A Dockerfile Formatter

#67
post #58

I don't want to vouch for the flagged and dead comment https://news.ycombinator.com/item?id=43630653 because I suspect it was killed for its tone but wow it is really illustrative of the QA that didn't go into this product

What I can do for you is fix the bugs promptly! I resolved the bugs in the `0.2.7` release. I haven't graduated college yet and don't have a full time job, so my QA skills are still improving.

Everyone starts somewhere. Good for you for putting it out there!
Post reply on HN