Blog · Deploy guides

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

By the Pethost team · · 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 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.

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 and nothing metered: the second site costs nothing more.

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. The plans are on the 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.

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
  2. VitePress: deploy your site
  3. pethost, the command line of Pethost

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