#Docker error

3 messages · Page 1 of 1 (latest)

kind torrent
#

Hi everyone

I'm newbie, hope someone can help me.
I´m trying to dockerize my Payload app but I´m getting an error "ENOENT: No such file or directory /home/node/app/.next/BUILD_ID"

I ran successfully:

docker build -t payload_app .

Later on I try to run my docker image:

docker run -p 3005:3000 --env-file=.env payload_app

But it doesn't start, I get UnhandledRejection ERROR ENOENT: No such file or directory /home/node/app/.next/BUILD_ID errno: -2

desert canopyBOT
fleet meteor
#

I presume you are using the website-template or ecommerce-template. I just came across this issue too. Here is my solution:
In the ./Dockerfile you should add a line to copy over the .next directory after the build process, here is my dockerfile showing that along with the build and dist directories created in the build process I incude the .next directory.
`FROM node:18.8-alpine as base

FROM base as builder

WORKDIR /home/node/app
COPY package*.json ./

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload/payload.config.js

WORKDIR /home/node/app
COPY package*.json ./
COPY yarn.lock ./

RUN yarn install --production
COPY --from=builder /home/node/app/dist ./dist
COPY --from=builder /home/node/app/build ./build
COPY --from=builder /home/node/app/.next ./.next

EXPOSE 80

CMD ["node", "dist/server.js"]`