next build : docker build image [Couldn't find any `pages` or `app` directory]
Answered
French Angora posted this in #help-forum
French AngoraOP
please help me to find out this error
i'm using docker-compose in my next.js app
while building image
Please help me😀ðŸ˜
docker-compose yml file
this is my dockerfile
i'm using docker-compose in my next.js app
yarn dev in dockerfile works wellwhile building image
yarn build no works it gets this error Please help me😀ðŸ˜
> Build error occurred
Error: > Couldn't find any `pages` or `app` directory. Please create one under the project root
at findPagesDir (/app/node_modules/next/dist/lib/find-pages-dir.js:54:15)
at /app/node_modules/next/dist/build/index.js:195:75
at async Span.traceAsyncFn (/app/node_modules/next/dist/trace/trace.js:103:20)
at async build (/app/node_modules/next/dist/build/index.js:148:29)
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.docker-compose yml file
version: '3.8'
services:
client:
container_name: next-app
build:
context: ./client
target: prod
ports:
- '3000:3000'this is my dockerfile
FROM node:18-alpine as prod
WORKDIR /app
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN yarn install
RUN yarn build
COPY . .
EXPOSE 3000
CMD ["yarn", "start"]10 Replies
@@ts-ignore move `yarn build` after `COPY . .`
French AngoraOP
oh yes !
it works well 😀
but why this works?
it works well 😀
but why this works?
@French Angora oh yes !
it works well 😀
but why this works?
the build command needs the source code which is only available once you
COPYFrench AngoraOP
oh yes thanks a log
@French Angora oh yes thanks a log
np mark this as solved
French AngoraOP
actually im finding how to mark as answered 🥲
@French Angora actually im finding how to mark as answered 🥲
follow the instructions in the embed
French AngoraOP
ðŸ˜
thanks :)
French AngoraOP
oh i did thanks~!