ericallam opened a new issue, #283:
URL: https://github.com/apache/pulsar-client-node/issues/283

   I'm using Pulsar in 
[trigger.dev](https://github.com/triggerdotdev/trigger.dev) and I'm trying to 
deploy a Node.js web service that has a dependency on this package in a Docker 
container. I'm running into issues trying to get this dependency to work and I 
was wondering if there is any guidance on the best way to build a Docker 
container with this package.
   
   Here is the 
[Dockerfile](https://github.com/triggerdotdev/trigger.dev/blob/main/apps/webapp/Dockerfile)
 for reference, which does build but is failing to work once I try running it:
   
   ```
   FROM node:lts-bullseye-slim AS pruner
   RUN apt-get update && apt-get install openssl -y
   WORKDIR /app
   RUN npm install turbo -g
   COPY . .
   RUN turbo prune --scope=webapp --docker
   RUN find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
   
   # Base strategy to have layer caching
   FROM node:lts-bullseye-slim AS base
   RUN apt-get update && apt-get install openssl g++ make wget python3 -y
   ENV PULSAR_CPP_CLIENT_VERSION=2.10.3
   RUN wget 
https://archive.apache.org/dist/pulsar/pulsar-${PULSAR_CPP_CLIENT_VERSION}/DEB/apache-pulsar-client.deb
 -q
   RUN wget 
https://archive.apache.org/dist/pulsar/pulsar-${PULSAR_CPP_CLIENT_VERSION}/DEB/apache-pulsar-client-dev.deb
 -q
   RUN dpkg -i --force-architecture ./apache-pulsar-client*.deb
   WORKDIR /app
   COPY .gitignore .gitignore
   COPY --from=pruner /app/out/json/ .
   COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml
   COPY --from=pruner /app/out/pnpm-workspace.yaml ./pnpm-workspace.yaml
   
   FROM base AS production-deps
   WORKDIR /app
   RUN npm install turbo -g
   RUN corepack enable
   ENV NODE_ENV production
   RUN npm config set python /usr/bin/python3
   COPY --from=pruner /app/out/full/apps/webapp/prisma/schema.prisma 
/app/apps/webapp/prisma/schema.prisma
   RUN pnpm install --prod --frozen-lockfile
   RUN pnpx prisma generate --schema /app/apps/webapp/prisma/schema.prisma
   
   FROM base AS builder
   WORKDIR /app
   RUN npm install turbo -g
   COPY turbo.json turbo.json
   RUN corepack enable
   COPY --from=pruner /app/out/full/ .
   RUN npm config set python /usr/bin/python3
   ENV NODE_ENV development
   RUN pnpm install --ignore-scripts --frozen-lockfile
   RUN pnpm run generate
   RUN pnpm run build --filter=webapp...
   
   # Runner
   FROM node:lts-bullseye-slim AS runner
   RUN apt-get update && apt-get install openssl g++ make wget python3 -y
   ENV PULSAR_CPP_CLIENT_VERSION=2.10.3
   RUN wget 
https://archive.apache.org/dist/pulsar/pulsar-${PULSAR_CPP_CLIENT_VERSION}/DEB/apache-pulsar-client.deb
 -q
   RUN wget 
https://archive.apache.org/dist/pulsar/pulsar-${PULSAR_CPP_CLIENT_VERSION}/DEB/apache-pulsar-client-dev.deb
 -q
   RUN dpkg -i --force-architecture ./apache-pulsar-client*.deb
   RUN npm install turbo -g
   WORKDIR /app
   RUN corepack enable
   ENV NODE_ENV production
   RUN addgroup --system --gid 1001 nodejs
   RUN adduser --system --uid 1001 remixjs
   RUN chown -R remixjs:nodejs /app
   USER remixjs
   
   COPY --from=pruner --chown=remixjs:nodejs /app/out/full/ .
   COPY --from=production-deps --chown=remixjs:nodejs /app .
   COPY --from=builder --chown=remixjs:nodejs 
/app/apps/webapp/app/styles/tailwind.css ./apps/webapp/app/styles/tailwind.css
   COPY --from=builder --chown=remixjs:nodejs /app/apps/webapp/build/server.js 
./apps/webapp/build/server.js
   COPY --from=builder --chown=remixjs:nodejs /app/apps/webapp/build 
./apps/webapp/build
   COPY --from=builder --chown=remixjs:nodejs /app/apps/webapp/public 
./apps/webapp/public
   COPY --from=builder --chown=remixjs:nodejs 
/app/apps/webapp/prisma/schema.prisma ./apps/webapp/build/schema.prisma
   COPY --from=builder --chown=remixjs:nodejs 
/app/apps/webapp/prisma/migrations ./apps/webapp/build/migrations
   COPY --from=builder --chown=remixjs:nodejs 
/app/apps/webapp/node_modules/.prisma/client/libquery_engine-debian-openssl-1.1.x.so.node
 ./apps/webapp/build/libquery_engine-debian-openssl-1.1.x.so.node
   
   # release_command = "pnpx prisma migrate deploy --schema 
apps/webapp/prisma/schema.prisma"
   ENTRYPOINT ["pnpm", "--filter", "webapp", "run", "start"]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to