Documentation about using Vike with Docker.

💚
This page is maintained by the community and may contain outdated information; PR welcome to update or improve it.

From the server's perspective, a Vike app is just a Node.js server, which means you can use any Node.js container image to run your Vike app.

If you use Docker also for development, and HMR doesn't work or you can't access your Vike app, then see Development.

If you build your app inside your Docker container and run into out-of-memory errors, then see Out-of-memory errors.

Development

You can use Docker also for development, see workarounds if you run into following issues:

HMR doesn't work

If you are using Docker and HMR doesn't work:

Cannot access app

Vite's server.host setting should be truthy so that your app can be accessed from outside your Docker container, such as from the browser.

Vike automatically changes the default value of server.host from false to true if it detects a Docker or Podman container environment.

Out-of-memory errors

If you build your app inside your Docker container, you may stumble upon out-of-memory errors.

Check whether your Docker container has enough memory, and you may also need to set Node.js' --max-old-space-size.

// package.json
{
  "scripts": {
    "build": "vike build"
    "// Increase Node.js memory size to 3GB": "", 
    "build": "NODE_OPTIONS=--max-old-space-size=3072 npm run build:vite", 
    "build:vite": "vike build"
  }
}