Skip to content

Commit

Permalink
chore(docs): Add mentioning of HOSTNAME env variable for standalone o…
Browse files Browse the repository at this point in the history
…utput (#52804)

### What?

Update documentation to mention a `HOSTNAME` env variable for `standalone` output

Related to Feature: #44627 

### Why?

Current documentation mentions only `PORT` env, but does not mention `HOSTNAME` added in January

Affected documentation pages:

- https://nextjs.org/docs/app/api-reference/next-config-js/output

Affected examples:

- https://github.com/vercel/next.js/tree/canary/examples/with-docker
- https://github.com/vercel/next.js/tree/canary/examples/with-docker-multi-env

### How?

- Run examples
- Check documentation
  • Loading branch information
steppefox committed Jul 17, 2023
1 parent 98a8b1c commit 0084166
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/02-app/02-api-reference/05-next-config-js/output.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Additionally, a minimal `server.js` file is also output which can be used instea
>
> - `next.config.js` is read during `next build` and serialized into the `server.js` output file. If the legacy [`serverRuntimeConfig` or `publicRuntimeConfig` options](/docs/app/api-reference/next-config-js/runtime-configuration) are being used, the values will be specific to values at build time.
> - If your project uses [Image Optimization](/docs/app/building-your-application/optimizing/images) with the default `loader`, you must install `sharp` as a dependency:
> - If your project needs alternative port or hostname for listening, you can define `PORT` and `HOSTNAME` environment variables, before running `server.js`. For example, `PORT=3000 HOSTNAME=localhost node server.js`.
</AppOnly>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ USER nextjs
EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME localhost

CMD ["node", "server.js"]
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ USER nextjs
EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME localhost

CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions examples/with-docker-multi-env/docker/staging/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@ USER nextjs
EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME localhost

CMD ["node", "server.js"]
1 change: 1 addition & 0 deletions examples/with-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ USER nextjs
EXPOSE 3000

ENV PORT 3000
ENV HOSTNAME localhost

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

0 comments on commit 0084166

Please sign in to comment.