I'm currently in the process of enhancing my existing NextJS + TypeScript project with Docker support and preparing to deploy it on Google Cloud Run. To achieve this, I've been referring to a helpful guide available at: https://github.com/vercel/next.js/tree/canary/examples/with-docker.
However, I've encountered an issue during the "build your container" step:
docker build -t nextjs-docker .
This step keeps failing with an error message stating that the "stat app/.next/standalone: file does not exist" error.
Upon inspecting my .next folder, I realized that the standalone file is not being generated, resulting in the aforementioned error. What steps should I take to create the .next/standalone file?
Here's a snippet from my next.config.js file:
module.exports = {
eslint: {
ignoreDuringBuilds: true,
},
experimental: {
outputStandalone: true
}
}
Additionally, below is an excerpt from my Dockerfile for reference:
# Install dependencies only when needed
FROM node:16-alpine AS deps
...
While attempting to follow the given instructions, it seems that the configuration provided in next.config.js along with running npm run build
should generate the .next/standalone file. However, this approach doesn't seem to be effective in resolving the issue.