Closed coopbri closed 1 year ago
I was able to work around this issue by generating the artifacts outside of the container as normal, and then COPY
ing them in during build. Definitely open to ideas if there is a way to make it work within the container, but this works just fine so no big deal either way.
Another potential workaround might be to disable the generator via a custom env var, for example as prisma-erd-generator
does: https://github.com/keonik/prisma-erd-generator#disabled
Thanks for submitting this great bug report!
Something that seems off to me is that the permissions given to the js file after build do not include execution permissions. I've also listed the permissions given to index.js of the Prisma cli for reference:
I'll have a look if I can reproduce the bug!
Update: prisma seems to have a final build step where they run chmod on the executable, this tells me that this could be our issue
What happens if you put RUN chmod +x node_modules/prisma-generator-pothos-codegen/src/bin.js
in front of the generate command? If that doesn't fix it then I'm on the wrong track I think
Wow, nice catch and what an easy fix. Adding RUN chmod +x node_modules/prisma-generator-pothos-codegen/src/bin.js
to the Dockerfile fixed it for me. Thank you!!
I could submit a PR with documentation for Docker and/or an example Dockerfile, or we could close this issue now that it's documented and solved thanks to you. What do you think?
If the other generators don't need this step, it might be a case of just uploading an executable version of the bin I believe the issue can remain open while we test this solution :D
The Pothos Codegen Prisma generator works great for me in a "regular" environment, however I am unable to build a Docker container with it. Here's a minimal container file that I'm working with:
When I build the image, I get the following error:
I have tried changing folder permissions within the container (particularly the path of the generated output), manually creating the output folder with a
mkdir
containerRUN
command, etc. I am sure this is just a Docker permission issue, however I'm unsure how to solve it, I am using other Prisma generators that write to the container filesystem and they work. The image builds perfectly when I disable this generator plugin/remove fromschema.prisma
.Has anyone been able to get a working container setup with this generator?