---
title: "How to deploy a VitePress site in 2026: one command, HTTPS and a Dockerfile you keep | Pethost"
description: "Deploy a VitePress site with one command: pethost deploy writes the Dockerfile, builds the site and serves it over HTTPS, on a machine that is €9.99 a month."
---

[Blog](https://pethost.dev/blog/) · Deploy guides

# How to deploy a VitePress site in 2026: one command, HTTPS and a Dockerfile you keep

By the Pethost team · 10 October 2026 · 8 min read

You have a VitePress site that builds on your laptop, and you want it online at an address with HTTPS. On Pethost that is one command, `pethost deploy`, run in the folder that has `package.json`. It writes the Dockerfile for you, builds the site and prints its address. VitePress's own starter was built and started in 43 seconds the first time.

**In short**

- **One command:** `pethost deploy` in the folder that has `package.json`. There is no config file to write and no build settings to fill in.
- **What it does:** finds the script that runs `vitepress build`, writes a Dockerfile that runs it, and serves `docs/.vitepress/dist`.
- **The address:** `https://my-docs.yourname.pethost.app`, with HTTPS at once. Your own domain is one DNS record.
- **The Dockerfile is yours:** it stays in the folder for you to keep and change, and pethost never writes it again.
- **The price:** €9.99 a month for a machine of 2 vCPU, 3 GB and 30 GB that runs this site and every other project you have. There is no free tier.

## What you need to deploy a VitePress site in 2026

Three things: the site, the `pethost` command and a Pethost account.

**The site** is a folder as VitePress's getting started leaves it: `npm add -D vitepress`, then `npx vitepress init`. The wizard puts the pages into `docs/` and three scripts into `package.json`:

```
"scripts": {
  "docs:dev": "vitepress dev ./docs",
  "docs:build": "vitepress build ./docs",
  "docs:preview": "vitepress preview ./docs"
}
```

**The command** is one program, installed by one line:

```
curl -fsSL https://pethost.dev/install.sh | sh      # macOS, Linux
irm https://pethost.dev/install.ps1 | iex           # Windows, in PowerShell
```

**The account** needs a plan. If you are not signed in, `pethost deploy` opens your browser and signs you in. If you have no plan yet, it shows you where to choose one, and waits.

## Deploy the VitePress site with one command

Go to the folder that has `package.json` and run `pethost deploy`. This is the whole screen, for the starter that `vitepress init` writes:

```
$ cd my-docs
$ pethost deploy
Name it [my-docs]:    it will live at https://my-docs.sam.pethost.app
✓ Packed 6 files, 90 KB   (left out node_modules)
✓ Uploaded straight to your machine
✗ /compose.yaml: the project directory has no compose.yaml at its root: add one
✓ VitePress site detected, wrote Dockerfile.
✓ Packed 7 files, 91 KB   (left out node_modules)
✓ Uploaded straight to your machine
✓ Built and started in 43 s
  · wrote compose.yaml for the Dockerfile: the service app, reading .env, port 80
✓ app listens on 80 → https://my-docs.sam.pethost.app
  It answers 200.

https://my-docs.sam.pethost.app

Wrote .pethost (commit it). Next:   pethost logs -f   ·   pethost open
```

1. **It asks one thing** The project's name, which is the first word of its address. Enter takes the folder's name.
2. **The machine finds nothing to run** The folder goes straight to your machine, without `node_modules`. The line with the cross is its answer: a project runs from a Dockerfile or a Compose file, and the folder has neither yet.
3. **pethost writes the Dockerfile** It saw `vitepress` in `package.json` and a script that runs `vitepress build`, and uploads the folder again.
4. **The machine builds and starts it** Then pethost asks the address itself, and prints what it answered: 200.

The file `.pethost` says which project this folder is. Commit it with the Dockerfile, and the next deploy asks nothing.

## The Dockerfile that pethost writes for VitePress

This is the file as it was written into the starter's folder, whole:

```
# Written by pethost deploy for this VitePress site: package.json builds it with
# "vitepress build ./docs", which writes docs/.vitepress/dist, Node 24 (no .nvmrc names
# another), npm installs it (package-lock.json).
# It is yours now: change it as you like. pethost does not write it again.

FROM node:24 AS build
WORKDIR /app

COPY . .

# Every dependency: what builds the project, and may start it, is among the ones for
# development.
RUN --mount=type=cache,target=/root/.npm \
    npm install

RUN npm run docs:build

# The site is files: Caddy serves them on port 80.
FROM caddy:2
COPY --from=build /app/docs/.vitepress/dist /srv

COPY <<'EOF' /etc/caddy/Caddyfile
:80 {
	root * /srv
	# A browser that takes its answers compressed gets them so.
	encode
	# Names that begin with a dot are no pages;
	# .well-known is the one such folder that is there for visitors.
	@own {
		path */.*
		not path /.well-known/*
	}
	error @own 404
	# A page's address works without its ".html", and a folder's leads to its index.html.
	try_files {path} {path}.html {path}/
	file_server
	# An address that is no page: the site's own 404.html, if it has one.
	handle_errors 404 {
		rewrite * /404.html
		file_server
	}
}
EOF
EXPOSE 80
```

Its first lines say what pethost read in your folder. Three things come from there:

- **The package manager** is the one your lockfile names: npm, pnpm, Yarn or Bun.
- **The Node version** is the one `.nvmrc` or `.node-version` names, and Node 24 where there is neither.
- **The folder to serve** follows the script: `vitepress build ./docs` writes `docs/.vitepress/dist`, and `vitepress build` alone writes `.vitepress/dist`.

The second half is a small web server for the built pages. We asked the deployed starter what a visitor asks. The home page, `/markdown-examples` and `/markdown-examples.html` each answered 200, and an address that is no page answered 404 with VitePress's own “404” page.

Two more things keep a wrong file away from you. If the machine cannot build or start the Dockerfile pethost wrote, pethost takes the file back out of your folder and says what failed. And if your config sets `base` to a path like `/docs/`, pethost writes nothing and says why: on Pethost a site is at the root of its own address, so set `base` to `"/"` and deploy again.

## Change a page and deploy again

Edit a page and run the same command. The second deploy of the starter took 4 seconds, because the machine keeps the build's layers:

```
$ pethost deploy
my-docs (.pethost)
✓ Packed 8 files · uploaded · built and started in 4 s
  · wrote compose.yaml for the Dockerfile: the service app, reading .env, port 80
  · kept the project's x-pethost
  It answers 200.
https://my-docs.sam.pethost.app
```

To deploy on every push instead, connect the repository once:

```
pethost github sam/my-docs          # from now on, every push deploys itself
```

Pethost reads only the repositories you gave its GitHub App. If a deploy goes wrong, `pethost rollback` puts the version before it back, and your machine keeps the three versions before the current one. An AI agent can do all of this for you through Pethost's MCP server: [how an agent deploys and looks after a project](https://pethost.dev/blog/hosting-for-ai-coding-agents/).

## Use your own domain for the docs

Any name under your account's domain is an address at once, with HTTPS. A domain you own takes one command and one DNS record:

```
pethost domain add docs.example.com
```

The command prints the record to make: a CNAME from your name to your machine's name. The certificate comes by itself once the name resolves, and renews itself. `pethost password` puts a password page in front of the whole site, for docs that are not public yet.

## What you get for the price

Pethost is €9.99 a month for everything you host, on 2 vCPU, 3 GB of memory and 30 GB of disk. A built VitePress site is files behind one small web server, so the machine has room for the application the docs describe, its database and your other projects. There is [no fee per project](https://pethost.dev/blog/unlimited-projects-flat-monthly-fee/) and nothing metered: the second site costs nothing more.

- **€9.99** a month for the whole machine
- **43 s** to build and start the starter, the first time
- **0** files to write by hand

What is already done on it: HTTPS with certificates that renew themselves, deploys from GitHub, nightly backups kept for 14 days, SSH into any container, and every request counted. The panel shows the busiest paths of the last 30 days, which for a docs site is the list of pages people really read. The machine is always on, so a page [never waits for a cold start](https://pethost.dev/blog/always-on-hosting-no-cold-starts/). The plans are on the [pricing](https://pethost.dev/#pricing) part of the first page.

**Which pages people read.** A project's ten busiest paths with their share and response times, and the log of single requests.

![The Pethost panel: a project's ten busiest paths with share, count and response times, and the log of single requests.](https://pethost.dev/shots/traffic.webp)

### Pethost is the best pick for

- **Developers who keep the docs beside the app**: the API, its database and its VitePress site on one machine, on one bill
- **Solo developers** with several side projects, each with a site of its own
- **People whose agent deploys for them**: Claude Code or Codex puts the site online and reads its logs
- **Small teams** who want the docs behind a password page until launch

### Look elsewhere if

- Your application needs several regions or autoscaling

## Questions

### Does a VitePress site need a Dockerfile to deploy?

On Pethost a project runs from a Dockerfile or a Compose file, and you do not have to write it: in a folder that has neither, `pethost deploy` writes the Dockerfile for a VitePress site and deploys it. The file stays in your folder, and you can change it.

### Which package manager and Node version does the VitePress build use?

The ones your folder names. The package manager is your lockfile's: npm, pnpm, Yarn or Bun. The Node version is the one in `.nvmrc` or `.node-version`, and Node 24 where there is neither.

### Can I deploy VitePress from GitHub on every push?

Yes. Deploy the folder once with `pethost deploy`, then run `pethost github owner/repository`. From then on every push to the repository deploys itself, and `pethost rollback` goes back to an earlier commit.

### How do I use a custom domain with HTTPS for a VitePress site?

Run `pethost domain add docs.example.com` and make the one DNS record it prints, a CNAME to your machine's name. The certificate comes by itself once the name resolves, and renews itself.

### What does it cost to host a VitePress site on Pethost?

€9.99 a month for the Starter machine of 2 vCPU, 3 GB and 30 GB, with no fee per project: the same machine runs your other sites, apps and databases. There is no free tier. Prices are without VAT.

### Why does pethost deploy refuse a VitePress site that sets base?

A site built with `base` set to a path like `/docs/` looks for its styles and scripts under that path. On Pethost a site is at the root of its own address, so pethost writes no Dockerfile for it and says so. Set `base` to `"/"` and deploy again.

The screens are deploys of the site that `vitepress init` writes, with VitePress 1.6.4 and pethost 0.2.1, on a test machine of ours. The account in them is the example one, `sam`.

1. [VitePress: getting started](https://vitepress.dev/guide/getting-started)
2. [VitePress: deploy your site](https://vitepress.dev/guide/deploy)
3. [pethost, the command line of Pethost](https://github.com/pethost-dev/cli#readme)

## Put your projects online today

A machine of your own, as many projects as fit, one flat price. Nothing metered, nothing billed on top.

[Host all your projects for €9.99/mo](https://console.pethost.dev/)

## Keep reading

- 25 September 2026 [Hosting providers with an official MCP server in 2026: deploy, logs and rollback compared](https://pethost.dev/blog/hosting-with-mcp-server/) 18 of 19 hosting platforms have an official MCP server in 2026. Two have a rollback tool. Pethost's 13 tools deploy, read logs, roll back and restore.
- 16 September 2026 [Hosting for AI coding agents in 2026: let Claude Code or Codex deploy and debug production](https://pethost.dev/blog/hosting-for-ai-coding-agents/) To let Claude Code or Codex deploy and debug production alone, a host must give the agent five things. Pethost does, with 13 MCP tools, from €9.99 a month.
- 27 September 2026 [European hosting for an app with Postgres at a flat monthly price in 2026: what €10 a month buys](https://pethost.dev/blog/european-hosting-postgres-flat-price/) An app with Postgres in the EU at a flat monthly price is €9.99 on Pethost: a 3 GB machine for every project that fits. Eleven hosts, priced.
- 21 September 2026 [Hosting with unlimited projects for one flat monthly fee in 2026: a price per machine, not per app](https://pethost.dev/blog/unlimited-projects-flat-monthly-fee/) Hosting priced per machine runs as many projects as fit for one flat monthly fee. Six small apps: €9.99 on Pethost, $30 on Railway, $42 on Render.

[All articles](https://pethost.dev/blog/) · [About Pethost](https://pethost.dev/about/) · [Pricing](https://pethost.dev/#pricing)

Pethost · Stephan Gomer · NIP 1133096755

[Home](https://pethost.dev/) [About](https://pethost.dev/about/) [Blog](https://pethost.dev/blog/) [Terms](https://pethost.dev/terms/) [Privacy](https://pethost.dev/privacy/) [Refunds](https://pethost.dev/refunds/) [support@pethost.dev](mailto:support@pethost.dev)
