devthefuture-org / dockerfile-x

Dockerfile factorization superset
https://codeberg.org/devthefuture/dockerfile-x/
MIT License
35 stars 4 forks source link

Instructions for debugging #2

Closed aditya211935 closed 11 months ago

aditya211935 commented 1 year ago

I'm trying to add capability to add docker args to construct paths in INCLUDE command. However, to do that I'd need to put some logs in the node and go code to see how to get info from daemon and in which shape they come. As I understand it, our dockerfile frontend is just a container that is run to parse a dockerfile into llb. Do you know if it's possible to see logs from dockerfile frontend container? I followed the steps for debugging, but even then I couldn't see logs from the container. Any help is really appreciated, thanks!

aditya211935 commented 1 year ago

@devthejo ^

devthejo commented 1 year ago

@aditya211935 You need to add a log instruction in the go code here: https://github.com/devthefuture-org/dockerfile-x/blob/85c771cbc0b7787619bfa80968f0c9d5e2addabb/pkg/llb/build.go#L105C1-L105C1 logging &stdout like log.Println(stdout), or you could also throw an Error from js code containing what you want to output to frontend, the error from js will be printed to frontend output

aditya211935 commented 1 year ago

@devthejo Thank you!! I guess debugging JS code is really easy since all it does it take a dockerfile with our custom syntax, and convert it into another dockerfile that default dockerfile frontend can convert into llb, right?

devthejo commented 1 year ago

@devthejo Thank you!! I guess debugging JS code is really easy since all it does it take a dockerfile with our custom syntax, and convert it into another dockerfile that default dockerfile frontend can convert into llb, right?

exactly