Deploy a static site

Plain HTML, CSS, and JS on a live HTTPS URL.

If your project is just files (an index.html with some CSS and JavaScript) you only need a small server to hand those files out on the port Dockhold assigns. This recipe is the whole path.

In a hurry? Start from the ready-madestatic-starter template: click Use this template on GitHub, thendeploy it. Or follow the steps below to add this to a project you already have.

1. Add a one-line static server

Add the serve package and a start script. If you don't have a package.json yet, create one withnpm init -y first.

npm install --save-dev serve

Then in package.json:

{
  "scripts": {
    "start": "serve -l $PORT ."
  }
}

serve -l $PORT . serves the current folder (where yourindex.html lives) on the assigned port, on all interfaces. If your files live in a subfolder, point at it: serve -l $PORT public.

Your app must listen on 0.0.0.0 and read its port from thePORT environment variable. Never localhost, never a hardcoded port. Dockhold assigns PORT at runtime; an app that ignores it can't receive traffic.

2. Connect the repo and deploy

  1. Push the project to a GitHub repository.
  2. Open the dashboard, connect GitHub, and pick the repo.
  3. On a paid plan (any account with compute added), Dockhold detects the Node project, runs npm install, and starts it with npm run start. Nothing else to do.
  4. On a free account, add the Dockerfile below at the root of your repo first. Auto-detection is a paid feature, so without one the deploy stops right away and tells you.
# Dockerfile
FROM node:22-alpine
RUN npm install -g serve@14
WORKDIR /site
COPY . .
CMD serve -l $PORT .

Your site goes live at https://<your-app>.dockhold.appwith HTTPS handled for you. Every later push to your main branch redeploys.

Troubleshooting

  • 404 at the root: the folder you pass to servemust contain an index.html. Use serve -l $PORT publicif it's in a subfolder.
  • Build fails with "no start script": confirm thestart script is in package.json and spelled exactly as above.
  • A page loads but assets 404: use relative asset paths (./style.css), not absolute ones tied to your local folder.

Next