gcloud, docker and nextjs: Couldn't find a `pages` directory

Viewed 20

My config looks like this:

Dockerfile:

FROM node:current-alpine AS base
WORKDIR /base
COPY package*.json ./
RUN npm install
COPY . .

FROM base AS build
ENV NODE_ENV=production
WORKDIR /build
COPY --from=base /base ./
RUN npm run build

FROM node:current-alpine AS production
ENV NODE_ENV=production
WORKDIR /app
COPY --from=build /build/package*.json ./
COPY --from=build /build/build ./build
COPY --from=build /build/public ./public
RUN npm install next

EXPOSE 3000
CMD npm run start

next.config.js

const withPWA = require('next-pwa');
const runtimeCaching = require('next-pwa/cache');

module.exports = withPWA({
  distDir: 'build',
  pwa: {
    dest: 'public',
    runtimeCaching,
  },
  experimental: {
    outputStandalone: true,
  },
  staticPageGenerationTimeout: 10000,
});

this works fine if I use docker build -t [my project name] . command, but fails with the gcloud. I'm using it like this gcloud builds submit --tag gcr.io/my project name] --project my project name] --timeout=900s but keep getting the error:

Error: > Couldn't find a `pages` directory. Please create one under the project root

Not sure what am I doing

0 Answers
Related