-
Notifications
You must be signed in to change notification settings - Fork 26.2k
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
Next 14 is not working properly in docker on windows with bun, but normal at local terminal #66068
Comments
I have the same issue .next folder in docker only includes these files and folders
|
I can't see what it includes cuz it's crashing due to that build error above. |
@devhik0 You can ssh into the image by running 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 |
@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. |
hey,
|
So, update: Check your Dockerfile and other files to make sure its copying all files and have right permissions. # 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 |
Link to the code that reproduces this issue
https://github.com/devhik0/crm-saas
To Reproduce
Current vs. Expected behavior
Expected runs properly, but giving this error
Provide environment information
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
next build (local), next start (local)
Additional context
Everything normal at local setup, it's only happens at docker. Also here the link for discussion about this:
#65740
The text was updated successfully, but these errors were encountered: