Prisma CLI not working on Alpine Linux
Prisma CLI isn't working on Alpine Linux. Though it prints that that it has successfully downloaded, neither the version command (it doesn't print anything) nor the generate command (it panics) work. /root/.cache/prisma doesn't exist. If I replace the alpine image with the standard one (golang:1), everything works fine.
Error:
panic: could not run [generate]: fork/exec /root/.cache/prisma/binaries/cli/2.11.0/prisma-cli-linux: no such file or directory
goroutine 1 [running]:
main.main()
/go/pkg/mod/github.com/prisma/[email protected]/main.go:29 +0x493
exit status 2
Dockerfile:
FROM golang:1-alpine
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN ["go", "mod", "download"]
RUN ["go", "run", "github.com/prisma/prisma-client-go", "version"]
COPY ./prisma/schema.prisma ./prisma/
RUN ["go", "run", "github.com/prisma/prisma-client-go", "generate"]
COPY . .
RUN ["go", "build"]
RUN ["chmod", "+x", "./docker/entrypoint.sh"]
ENTRYPOINT ["./docker/entrypoint.sh"]
CMD ["./app"]
I can confirm this. I think the problem is that we use https://github.com/vercel/pkg for packing the NodeJS cli into the Go client, and it looks like something goes wrong on alpine linux specifically.
I remember when debugging alpine stuff that I ran into this error, and I think the file actually exists and the error message is simply misleading, though I'm not 100% sure.
For now, please use a non-alpine docker image. A much better way to optimise docker images is to use multi-stage builds, so the final image just uses a few megabytes of the final go binary, regardless of how big the build container was.
Is there any updates on this problem?
I had this issue with alpine as a base image, switching over to 1.16.4-buster fixed the issue.
fixed via #814 a while ago