Hello everyone i created a docker image and when I run it in Digital Ocean it seems stuck here. Any clue on how I can debug this?
Hi, your Docker instance is running here, what's the issue?
I can't access it
and usually it gives more info
there are a lot of initializing with different colors but in this case no
FROM node:18-alpine as base
RUN mkdir -p /app
WORKDIR /app
COPY package*.json .
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/server.js"]
I have this error now and this is my dockerfile
The default one on the payloadcms website also doesn't work
My Dockerfile looks like this, see
ENV PAYLOAD_CONFIG_PATH=/home/node/dist/payload.config.js
, maybe that can work for you.
FROM node:18-alpine as base
FROM base as builder
WORKDIR /home/node
COPY package*.json ./
COPY . .
RUN yarn install
RUN yarn build
FROM base as runtime
ENV PAYLOAD_CONFIG_PATH=/home/node/dist/payload.config.js
ENV NODE_ENV=production
WORKDIR /home/node
COPY package*.json ./
RUN yarn install --production
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/build ./build
EXPOSE 3000
CMD ["node", "dist/server.js"]
I think for you this might be
ENV PAYLOAD_CONFIG_PATH=/app/dist/payload.config.js
@xavierpacheco Are you using any CD tool (Github actions...) or is it your local dev environment causing the issue?
I'm using Github actions and building all assets through it, once uploaded to the server via SSH, I'm using the docker-compose file to run the instance, it looks like this:
payload:
image: node:18-alpine
ports:
- "${PAYLOAD_PORT}:${PAYLOAD_PORT}"
volumes:
- .:/home/node/app
- node_modules:/home/node/app/node_modules
working_dir: /home/node/app/
command: sh -c "yarn serve"
depends_on:
- mongo
environment:
MONGODB_URI: ${MONGODB_URI}
PORT: ${PAYLOAD_PORT}
NODE_ENV: ${NODE_ENV}
PAYLOAD_SECRET: ${PAYLOAD_SECRET}
Of course all the ENVs are at your disposal through the .env file, but I'm not teaching you anything here 🙂
I finally got what what wrong
I wasn't passing the config path :/
Docker cannot find config path
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.