Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won´t start in a docker container #2868

Open
Arcade1080 opened this issue May 4, 2024 · 0 comments
Open

Won´t start in a docker container #2868

Arcade1080 opened this issue May 4, 2024 · 0 comments

Comments

@Arcade1080
Copy link

Arcade1080 commented May 4, 2024

Given this docker image:


ARG NODE_VERSION
ARG BUILDER

FROM ${BUILDER} as build

WORKDIR /usr/src/build

RUN yarn workspace website build

RUN yarn workspaces focus website --production


FROM node:${NODE_VERSION}-alpine as website

ARG NODE_ENV

ENV NODE_ENV=${NODE_ENV}

WORKDIR /usr/app

RUN npm install -g pm2@4.5.6

COPY --from=build --chown=node:node /usr/src/build/node_modules ./node_modules
COPY --from=build --chown=node:node /usr/src/build/packages/website/package.json ./
COPY --from=build --chown=node:node /usr/src/build/packages/website/.next ./.next
COPY --from=build --chown=node:node /usr/src/build/packages/website/public ./public
COPY --from=build --chown=node:node /usr/src/build/packages/website/next.config.mjs ./
COPY --from=build --chown=node:node /usr/src/build/packages/website/theme.config.jsx ./
COPY --chown=node:node ./process.yml ./

RUN mkdir -p .next/cache/images && chown node:node .next/cache/images

USER node

EXPOSE 5002

CMD [ "pm2-runtime", "/usr/app/process.yml"]

(process.yml starts nextra w/ "npm run start")

The container displays this error message (via docker logs ..) after starting:

⨯ Failed to load next.config.mjs, see more info here https://nextjs.org/docs/messages/next-config-error Error: > Couldn't find any pagesorapp directory. Please create one under the project root at findPagesDir (/usr/app/node_modules/next/dist/lib/find-pages-dir.js:42:15) at findPagesDirectory (/usr/app/node_modules/nextra/dist/index.js:169:15) at Object.<anonymous> (/usr/app/node_modules/nextra/dist/index.js:173:53) at Module._compile (node:internal/modules/cjs/loader:1375:14) at Module._extensions..js (node:internal/modules/cjs/loader:1434:10) at Module.load (node:internal/modules/cjs/loader:1206:32) at Module._load (node:internal/modules/cjs/loader:1022:12) at cjsLoader (node:internal/modules/esm/translators:358:17) at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:307:7) at ModuleJob.run (node:internal/modules/esm/module_job:218:25)

This is the next.config.mjs:

/** @type {import('next').NextConfig} */
const nextConfig = {
  pageExtensions: ["js", "jsx", "ts", "tsx", "mdx"],
};

import nextra from "nextra";

const withNextra = nextra({
  theme: "nextra-theme-docs",
  themeConfig: "./theme.config.jsx",
});

export default withNextra(nextConfig);

Any help would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant