Please help to launch payload in dockerfile.
My command start:
"start": "cross-env PAYLOAD_CONFIG_PATH=dist/payload.config.js NODE_ENV=production node dist/server.js",
You can run de server.js directly with node. Like this:
FROM node:18.16.0-bullseye-slim as base # Build container with dev dependencies FROM base as builder WORKDIR /home/node COPY package*.json ./ COPY . . # Public env variables are added to the react frontend at build time by webpack. ARG PAYLOAD_PUBLIC_FRONTEND_URL RUN npm install -g npm@latest && npm install && npm run build # Build production container FROM base as runtime ENV NODE_ENV=production ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js ENV APP_PORT=8080 WORKDIR /home/node COPY package*.json ./ RUN npm install -g npm@latest && npm install --production --legacy-peer-deps && npm cache clean --force COPY --from=builder /home/node/dist ./dist COPY --from=builder /home/node/build ./build COPY --from=builder /home/node/public ./public EXPOSE 8080 CMD ["node", "dist/server.js"]
But you should have a look at your build logs, it looks like some dependencies are missing.
It's possible this is related to peer dependencies as well since you're using npm
I would see if the example in the docs that uses yarn works any different:https://payloadcms.com/docs/production/deployment#docker