StyLua icon indicating copy to clipboard operation
StyLua copied to clipboard

Error using flags when building copying using Docker

Open AlejandroSuero opened this issue 1 year ago • 0 comments

I recently did a PR on oxsecurity/megalinter where I tried to include stylua in the linters for LUA. When using the Docker approach I ran into some issues, that using the cargo approach didn't trigger.

  1. The codebase of MegaLinter uses test to get the help command:
  1. The codebase of MegaLinter uses test to get the version command:
  1. The codebase of MegaLinter uses tests to check for successful or failure on .lua files:
  • When trying to use stylua --check lua_good_1.lua or stylua --check lua_bad_1.lua it wouldn't find stylua command.
  • reference to action failling

The codebase it's built using the Docker image python:3.12.6-alpine3.20.

The part where we use alpine is important. It doesn't use glibc (by default) (it uses musl), and it is often expected to use static linking to have binaries that can just be copied and just run.

I suspect that it could probably be copied from the docker image to any glibc-based image (almost any other distribution

In reference to this comment from one of the maintainers https://github.com/oxsecurity/megalinter/pull/3985#issuecomment-2346080384

Reference to show how I was copying using Docker here.

Reference to show how it's implemented using cargo here

[!note] I am curious why there is this difference from using cargo install to Docker's COPY --from.

AlejandroSuero avatar Sep 12 '24 13:09 AlejandroSuero