Docker cannot find config path

default discord avatar
xavierpacheco
3 months ago
6

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?

  • default discord avatar
    donfabrizio
    3 months ago

    Hi, your Docker instance is running here, what's the issue?

  • default discord avatar
    xavierpacheco
    3 months ago

    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

    image.png
  • default discord avatar
    twoxic
    3 months ago

    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
  • default discord avatar
    donfabrizio
    3 months ago

    @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 🙂

  • default discord avatar
    xavierpacheco
    3 months ago

    I finally got what what wrong



    I wasn't passing the config path :/

  • discord user avatar
    denolfe
    Payload Team
    3 months ago

    Docker cannot find config path

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.