Comments (7)
I have the same issue
Next 14.2.3
.next folder in docker only includes these files and folders
cache
prerender-manifest.js
package.json
routes-manifest.json
from next.js.
I can't see what it includes cuz it's crashing due to that build error above.
from next.js.
@devhik0 You can ssh into the image by running docker run --rm -it myimage:latest sh
(replace myimage:latest with your tag)
I do notice that it does work when I build the image in Github actions on ubuntu latest. When i'm building it on Mac m1 with --platform=linux/amd64
it doesnt create all files in .next
from next.js.
@tpdewolf Yes, but it's giving same error when I run container and stopping. Weird one, same app is running in GitHub actions machine on Ubuntu, but crashing on Windows. I tried building locally via Dockerfile, but when I run it crashed again cuz of same error.
from next.js.
hey,
almost the same for me:
- I use Next.js 14.2.3.
- The docker image run correctly on my local env but it gets stuck when i run the image on a ubuntu server.
- I build my image FROM node:20-slim
from next.js.
So, update: Check your Dockerfile and other files to make sure its copying all files and have right permissions.
Here i ll share what i changed and how it fixed everything.
# use the official Bun image
# see all versions at https://hub.docker.com/r/oven/bun/tags
FROM oven/bun:1 as base
WORKDIR /app
# install dependencies into temp directory
# this will cache them and speed up future builds
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lockb /temp/dev/
RUN cd /temp/dev && bun install
# install with --production (exclude devDependencies)
RUN mkdir -p /temp/prod
COPY package.json bun.lockb /temp/prod/
RUN cd /temp/prod && bun install --production
# copy node_modules from temp directory
# then copy all (non-ignored) project files into the image
FROM base AS prerelease
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED 1
# RUN bun run test #todo: add here after adding tests
RUN bun run build
# copy production dependencies and source code into final image
FROM base AS release
WORKDIR /app
# Set correct permissions for nextjs user and don't run as root
RUN adduser crm
RUN chown crm:bun .
USER crm
COPY --from=install /temp/prod/node_modules node_modules
COPY --from=prerelease --chown=crm:bun /app/.next ./.next
COPY --from=prerelease /app/node_modules ./node_modules
COPY --from=prerelease /app/package.json ./package.json
COPY --from=prerelease /app/public ./public
CMD ["bun", "run", "build"]
# run the app
EXPOSE 3000/tcp
CMD ["bun", "start" ]
If needs use it as reference
from next.js.
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
from next.js.
Related Issues (20)
- ECONNREFUSED when call backend API with docker name from /pages/api HOT 1
- Docs: Next Config Support For (Or Note not Supporting) next.config.mts HOT 2
- revalidatePath doesn't work with debouncing and page navigation
- Docs: Import React from "react" not added on the manual installation HOT 3
- Cache-Control is not appended to Dynamic Routing in Next.js 14.2.12 HOT 4
- Redirect function in server action ignores "replace" parameter HOT 1
- Refused to apply style from '/_next/static/css/336e4aea61098b4e.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. HOT 1
- Cookies being set with empty values in production in Next.js HOT 1
- Docs:
- Error: Failed to find Server Action "84c...c2". This request might be from an older or newer deployment. Original error: Cannot read properties of undefined (reading 'workers')
- Next 14.2.12 with react-pdf and pdfjs-dist | Build fails with webpack error: TypeError: Promise.withResolvers is not a function | Passes Vercel build with swcMinify: false HOT 2
- Remove `@opentelemetry/api` from edge bundle when telemetry is disabled HOT 1
- next config output="export" with appDir doesn't work HOT 2
- Headers function causing an empty page to be returned when using Optional Catch-all Segments HOT 3
- Module not found: Can't resolve '_http_common' HOT 2
- WebGL client component only renders when running "npm run dev" and not with "npm start" HOT 2
- Deprecated meta tag "apple-mobile-web-app-capable" HOT 1
- Next.js does not pick the correct export of dependency HOT 2
- Docs: HOT 1
- req.signal.onabort doesnโt work in Vercel function HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.