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

standalone nextjs after update to 13.4.16 no longer runs in container #54169

Closed
1 task done
igorroman777 opened this issue Aug 17, 2023 · 4 comments
Closed
1 task done
Labels
examples Issue/PR related to examples locked

Comments

@igorroman777
Copy link

igorroman777 commented Aug 17, 2023

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

nextjs 13.4.16

Which example does this report relate to?

https://github.com/vercel/next.js/tree/canary/examples/api-routes-rest

What browser are you using? (if relevant)

chrome

How are you deploying your application? (if relevant)

docker build . -t my-project:0.1.18 --no-cache

Describe the Bug

standalone nextjs after update to 13.4.16 from 13.4.0 no longer runs in container.
In version 13.4.0 ran fine.
My Dockerfile:

FROM node:18-alpine AS base
FROM base AS deps
RUN apk add --no-cache libc6-compat
RUN apk update && apk add git
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN \
  if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
  elif [ -f package-lock.json ]; then npm ci; \
  elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i --frozen-lockfile; \
  else echo "Lockfile not found." && exit 1; \
  fi

# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .

# Next.js collects completely anonymous telemetry data about general usage.
# Learn more here: https://nextjs.org/telemetry
# Uncomment the following line in case you want to disable telemetry during the build.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN yarn build

# If using npm comment out above and use below instead
# RUN npm run build

# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app

ENV NODE_ENV production
# Uncomment the following line in case you want to disable telemetry during runtime.
# ENV NEXT_TELEMETRY_DISABLED 1

RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs

USER nextjs

COPY --from=builder /app/public ./public

# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
COPY --from=builder /app/.next/cache ./.next/cache

EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME localhost

CMD ["node", "server.js"]

Expected Behavior

it must show index page in browser.

To Reproduce

it must show index page in browser.

@igorroman777 igorroman777 added the examples Issue/PR related to examples label Aug 17, 2023
@michalvadak
Copy link

Set the HOSTNAME to 0.0.0.0

@balazsorban44
Copy link
Member

Setting HOSTNAME is no longer required, you can just remove that line: #54093 (comment)

#54102

@nguaman
Copy link

nguaman commented Aug 18, 2023

Hello,

If I remove 'ENV HOSTNAME 0.0.0.0', it doesn't work on Google Cloud Run.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

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.

@github-actions github-actions bot added the locked label Sep 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
examples Issue/PR related to examples locked
Projects
None yet
Development

No branches or pull requests

4 participants