Web apps

    Deploy Next.js on Oracle Cloud's free tier

    Run the full Next.js server — SSR, API routes, ISR and middleware — on a persistent ARM VM instead of a serverless plan.

    At a glance

    Base imagenode:22-alpine
    Port3000
    Build commandnpm ci && npm run build
    Start commandnode server.js
    Infrastructure cost$0 on Oracle Always Free (platform fee for managed DevOps)

    Running Next.js on Ampere ARM

    Next.js builds natively on ARM64. Set `output: "standalone"` in next.config.js so the runtime image stays under 200 MB — the 1 OCPU / 6 GB shape has plenty of RAM, but a smaller image rebuilds far faster over a home connection.

    Steps

    1. Enable standalone output. Standalone output bundles only the files the server actually needs, which keeps the ARM image small and the boot time under a second.
      // next.config.js
      module.exports = { output: "standalone" };
    2. Add the Dockerfile. Use the multi-stage Dockerfile below, or generate one from your repo with the Dockerfile generator.
    3. Point Cheaploy at the repo. Connect GitHub, pick the repository and branch, and add your environment variables. Cheaploy clones on the VM, builds the image there, and swaps traffic to the new container only after the health check passes.
    4. Attach a domain. Add your domain in project settings and point an A record at the instance IP. Caddy issues and renews the TLS certificate automatically.

    Dockerfile for Next.js on ARM64

    FROM node:22-alpine AS deps
    WORKDIR /app
    COPY package*.json ./
    RUN npm ci
    
    FROM node:22-alpine AS build
    WORKDIR /app
    COPY --from=deps /app/node_modules ./node_modules
    COPY . .
    ENV NEXT_TELEMETRY_DISABLED=1
    RUN npm run build
    
    FROM node:22-alpine AS runner
    WORKDIR /app
    ENV NODE_ENV=production PORT=3000
    COPY --from=build /app/public ./public
    COPY --from=build /app/.next/standalone ./
    COPY --from=build /app/.next/static ./.next/static
    EXPOSE 3000
    CMD ["node", "server.js"]

    Need one tailored to your repository? The free Dockerfile generator writes an ARM-ready multi-stage build for you.

    Common mistakes

    • Build-time env vars are baked in: Anything prefixed NEXT_PUBLIC_ is inlined at build time. Changing it later requires a rebuild, not a restart.
    • Image builds run out of memory on the 1 GB shape: Use the Ampere A1 ARM shape (up to 4 OCPU / 24 GB across your tenancy) rather than the 1 GB AMD micro instance for anything that runs a webpack or Turbopack build.
    • sharp needs the musl build on Alpine: If next/image throws at runtime, either install `sharp` explicitly or switch the runner stage to `node:22-slim`.

    Related reading

    Get the Oracle Always Free deploy checklist

    One email with the exact steps, capacity workarounds and tools we use to ship apps for $0 of cloud spend.

    One email, no spam. Unsubscribe anytime.

    Frequently asked

    Does ISR and revalidation work?+

    Yes. Unlike serverless platforms, the Next.js server is a long-lived process with a real filesystem, so the ISR cache survives between requests instead of being rebuilt per invocation.

    Can I run the App Router and middleware?+

    Yes — running `next start` (or the standalone server) supports every Next.js feature, including middleware, route handlers and streaming.

    How much does this cost?+

    The Oracle Always Free compute is $0 forever. You pay Cheaploy a flat platform fee for the managed deploys, health checks, TLS and rollbacks.

    Deploy your project for $0

    No credit card. No Oracle sales call. Ship to your own cloud in under 10 minutes.

    Start free