# Deploying Next.js (standalone, ISR, next/image, Proxy)

Run a Next.js app on DeployVera as a Docker container: output standalone, PORT and HOSTNAME, and what works under next start (ISR, next/image with sharp, Proxy), with the Next.js documentation as the source.

Last reviewed: 2026-11-12

## What this covers

DeployVera runs your Next.js app as a continuously running Docker container on Node.js. That is the self-hosting model described in the Next.js documentation, not the Vercel platform runtime.

Framework features that depend on a Vercel-specific platform runtime, edge functions or a global CDN are outside this model. Features that work with `next start` on a Node.js server, such as the ones below, work in a container.

Claims about Next.js on this page come from the Next.js documentation: the self-hosting guide (last updated 2026-10-15) and the `output` reference (last updated 2026-09-18), both retrieved 2026-11-16. Check the current Next.js documentation before relying on a detail.

## output: 'standalone'

Set `output: 'standalone'` in the Next.js config. Per the documentation, this creates a `.next/standalone` folder that can be deployed on its own without installing `node_modules`, plus a minimal `server.js` that can be used instead of `next start`.

The minimal server does not copy the `public` or `.next/static` folders by default. The documentation says they can be copied into `standalone/public` and `standalone/.next/static` after `next build`, after which `server.js` serves them.

```
// next.config.js
module.exports = {
  output: 'standalone',
}
```

## PORT and HOSTNAME

Per the documentation, if the project needs to listen on a specific port or hostname, define the `PORT` or `HOSTNAME` environment variables before running `server.js`; for example `PORT=8080 HOSTNAME=0.0.0.0 node server.js` starts the server on `http://0.0.0.0:8080`.

In a container, set `HOSTNAME=0.0.0.0` so the server accepts connections from outside the container, and make `PORT` match the port you enter in the DeployVera panel.

## Example Dockerfile

A multi-stage Dockerfile that builds the app and runs the standalone server. Adjust the Node.js version and the package manager to your project.

Secret values belong in environment variables in the panel, not in the Dockerfile.

```
FROM node:22-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build

FROM node:22-alpine
WORKDIR /app
ENV NODE_ENV=production
ENV HOSTNAME=0.0.0.0
ENV PORT=3000
COPY --from=build /app/.next/standalone ./
COPY --from=build /app/.next/static ./.next/static
COPY --from=build /app/public ./public
EXPOSE 3000
CMD ["node", "server.js"]
```

## ISR, next/image and Proxy under next start

Image Optimization through `next/image` works self-hosted with zero configuration when deploying using `next start` (self-hosting guide). If you prefer a separate service, an image loader can be configured. The `output` reference lists `node_modules/sharp/**/*` as an example include pattern when tracing misses native files. On glibc-based Linux systems the guide notes that image optimization may need additional configuration to prevent excessive memory usage; the free plan has 512 MB RAM, so watch memory.

Proxy (the file convention that handles requests before routing) works self-hosted with zero configuration when deploying using `next start`; it is not supported with a static export.

Incremental Static Regeneration and the cache: per the guide, ISR uses the same Next.js server cache, stored by default on the local filesystem of each server instance, and this works automatically for a single instance with persistent local disk. On DeployVera the container’s writable layer is ephemeral, so the cache is rebuilt after a redeploy unless you mount persistent storage; running several instances needs a shared cache handler as described in the guide.

## Environment variables

By default, environment variables are only available on the server. Variables prefixed with `NEXT_PUBLIC_` are inlined into the JavaScript bundle during `next build` (self-hosting guide), so they must exist when the image is built; verify this in the build log.

Define server-side variables in the DeployVera panel as runtime environment variables.

## Limits

Next.js features that rely on Vercel-specific infrastructure are not provided. Databases on DeployVera are beta, and backups are platform-level with no self-service download or restore.

Where the Next.js documentation and your project’s Next.js version differ, the documentation for your version applies. Prices and plan limits are in the live catalog at /docker.

Sources: https://api.deployvera.com/api/plans · https://deployvera.com/docker · https://deployvera.com/help
