Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Docker cannot find config path

default discord avatar
xavierpacheco2 years 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
    otomorohq2 years ago

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

  • default discord avatar
    xavierpacheco2 years 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

  • default discord avatar
    twoxic2 years 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
    otomorohq2 years ago
    @316955211870502913

    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
    xavierpacheco2 years ago

    I finally got what what wrong



    I wasn't passing the config path :/

  • discord user avatar
    denolfe
    2 years ago

    Docker cannot find config path

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.