split-pro icon indicating copy to clipboard operation
split-pro copied to clipboard

`web-push` not available in docker image

Open brunobeeee opened this issue 7 months ago • 6 comments

I want to setup web-push but I had to notice that the web-push binary isn't copied inside the docker image in docker/Dockerfile.

COPY --from=base  /app/prisma/schema.prisma ./prisma/schema.prisma
COPY --from=base  /app/prisma/migrations ./prisma/migrations
COPY --from=base  /app/node_modules/prisma ./node_modules/prisma
COPY --from=base  /app/node_modules/@prisma ./node_modules/@prisma
COPY --from=base  /app/node_modules/sharp ./node_modules/sharp

So you can't use web-push when running in docker.

Thanks for your work I really like SplitPro!

brunobeeee avatar May 06 '25 15:05 brunobeeee

I'm running split-pro in docker and push notifications work perfectly.

FriesischScott avatar May 10 '25 19:05 FriesischScott

split-pro isn't using the web-push binary to send the notifications. It happens here: https://github.com/oss-apps/split-pro/blob/7f71b43c8f9fed8053ef76099542cde30b8ccb11/src/server/notification.ts#L12

FriesischScott avatar May 10 '25 19:05 FriesischScott

Did you correctly set the environment variables:

  • WEB_PUSH_EMAIL,
  • WEB_PUSH_PUBLIC_KEY,
  • WEB_PUSH_PRIVATE_KEY?

FriesischScott avatar May 10 '25 19:05 FriesischScott

No I see what your issue is. You're supposed to generated the web-push key somewhere else before running the container not inside.

FriesischScott avatar May 10 '25 20:05 FriesischScott

Oh yes you're right. I use docker only for splitpro and wanted to generate the keypair usind the container:

docker compose exec splitpro web-push generate-vapid-keys --json

This wouldn't work so I assumed that the webpush binary was missing inside the container and created PR #219.

Maybe it would be good to specify this in README.md or .env.example that it is not possible to generate the keypair inside the container?

brunobeeee avatar May 11 '25 09:05 brunobeeee

Idea: This is a minmal command to generate the keypair using a docker container:

docker run --rm node:20-alpine3.19 npx web-push generate-vapid-keys --json

node:20-alpine3.19 is the base layer of the split-pro image so you don't download the layers twice when running this command.

brunobeeee avatar May 11 '25 11:05 brunobeeee

Added comment in commit d212c6529e21d7864a9026272a2e8092eb2eba77

krokosik avatar Jul 01 '25 23:07 krokosik