stylelint: Fix hang inside Docker
What minimal example or steps are needed to reproduce the bug?
For reasons that are beyond the scope of this issue, I am looking to Docker-ise Stylelint and some configuration. It seems running it in inside Docker hangs when you point it to a valid docker path.
Dockerfile
FROM node:20-alpine3.17
RUN npm install -g stylelint stylelint-config-standard
Then running & accessing the docker container:
docker run -it --rm -v $(pwd):/app scss-stylelint-dev "/bin/sh"
Then running stylelint inside the container
stylelint app/**/*.css --config-basedir /usr/local/lib/node_modules/
Running this on my computer is near-instant, but inside the docker container this hangs for a long time - sometimes it is successful, other times not.
I am 100% happy to blame this on my dockering skills, but I’ve tried everything I can think of (yarn, instakling in different places etc)
What minimal configuration is needed to reproduce the bug?
{
"extends": "/usr/local/lib/node_modules/stylelint-config-standard"
}
How did you run Stylelint?
stylelint app/**/*.css --config-basedir /usr/local/lib/node_modules/
Which Stylelint-related dependencies are you using?
- stylelint@^13.0.0
- stylelint-config-standard@^34.0.0
What did you expect to happen?
It to lint the CSS
What actually happened?
It hangs when given a valid path. If the glob path is invalid, it exists quickly
Do you have a proposal to fix the bug?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 17 (10 by maintainers)
Thanks again for all your assistance @jeddy3 and @romainmenke. It was hugely appreciated and although, I was wasting your time you made me feel like I wasn’t 😄
This is all for CI purposes and in order to push it, it needed to be made with a slightly different platform (Mac M1 going to Debian Intel). Because of this, I was building and running the image with the
--platformattributes. Removing this and building a slightly more optimised docker image has got this down further (and looks similar to your experience)So ultimately everything was my fault. Sorry!
TL:DR;
node --cpu-profin front of your commandThanks again 😃
This is caused by the formatter.
I suspect this tries to determine the width of the output terminal? I can imagine that this extremely slow for Dockerized workloads.
Setting a different formatter should make it fast again :
--formatter unixhttps://stylelint.io/user-guide/options/#formatter
It’s great to know that all our performance work in
14.xand15.xhas born fruit.I think we can close the issue then.
@mikestreety If you do find the root cause, you’re welcome to share it here as it may benefit someone else.
Yes, please upgrade. The last
13.xrelease was over 2 years ago. There have been many releases since then.@romainmenke
--fixis appended