Web apps

    Deploy React (Vite) on Oracle Cloud's free tier

    Serve a production React build from Nginx on your own ARM server with HTTP/2, gzip and long-lived asset caching.

    At a glance

    Base imagenginx:alpine
    Port80
    Build commandnpm ci && npm run build
    Start commandnginx -g 'daemon off;'
    Infrastructure cost$0 on Oracle Always Free (platform fee for managed DevOps)

    Running React (Vite) on Ampere ARM

    A static React bundle is the lightest possible workload for an Ampere A1 core — a single 1 OCPU instance serves a Vite build to thousands of visitors a day without breaking a sweat.

    Steps

    1. Add an SPA-aware Nginx config. Without try_files, a hard refresh on /dashboard returns a 404 because no such file exists on disk.
      server {
        listen 80;
        root /usr/share/nginx/html;
        location /assets/ { expires 1y; add_header Cache-Control "public, immutable"; }
        location / { try_files $uri $uri/ /index.html; }
      }
    2. Build the image. Cheaploy builds on the VM so the ARM64 architecture always matches the host.
    3. Deploy and attach your domain. Point an A record at the instance IP; TLS is issued automatically on first request.

    Dockerfile for React (Vite) on ARM64

    FROM node:22-alpine AS build
    WORKDIR /app
    COPY package*.json ./
    RUN npm ci
    COPY . .
    RUN npm run build
    
    FROM nginx:alpine
    COPY --from=build /app/dist /usr/share/nginx/html
    COPY nginx.conf /etc/nginx/conf.d/default.conf
    EXPOSE 80
    CMD ["nginx", "-g", "daemon off;"]

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

    Common mistakes

    • Vite env vars must start with VITE_: Anything else is stripped from the client bundle at build time.
    • Blank page after deploy: Usually a wrong `base` in vite.config.ts. Keep it as `/` unless you serve from a subpath.
    • Stale assets: Cache hashed files under /assets aggressively, but never cache index.html.

    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

    Do I need a Node server for a Vite app?+

    No. The build output is static, so Nginx serves it directly — faster and with a much smaller image.

    Can I add an API later?+

    Yes. Run a second container on the same VM and proxy /api to it from Nginx or Caddy.

    Is this cheaper than Netlify or Vercel?+

    The hosting itself is $0 on Oracle Always Free, and there is no bandwidth overage — the free tier includes 10 TB of egress per month.

    Deploy your project for $0

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

    Start free