Deploy a Strapi app that uses npm

Reverhost builds every app from the Dockerfile stored on it, so you choose the install step. These are the lines to use for Strapi with npm.

Last updated November 25, 2026

What your Dockerfile runs

StepDockerfile line
Copy the manifestsCOPY package*.json ./
InstallRUN npm ci
Buildnpm run build, which runs strapi build
Startnpm start, which runs strapi start

Run scripts with npm run <script> if you prefer. Dev dependencies are installed before the build, and NODE_ENV=production is set only after it.

Dockerfile
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN --mount=type=secret,id=appenv,target=/run/secrets/appenv sh -c 'set -a; . /run/secrets/appenv; set +a; npm run build'
ENV NODE_ENV=production PORT=3000 HOST=0.0.0.0
EXPOSE 3000
CMD ["npm", "start"]

Deploy

Use Postgres rather than SQLite, and set Strapi's secret variables before the first deploy. The Node.js template works once HOST=0.0.0.0 is added to its ENV line.

npx ezhst projects create my-project --link
npx ezhst apps create my-app
npx ezhst link --project <project-slug> --app <app-slug>
npx ezhst env set APP_KEYS=<a>,<b> API_TOKEN_SALT=<salt> ADMIN_JWT_SECRET=<secret> TRANSFER_TOKEN_SALT=<salt> JWT_SECRET=<secret>
npx ezhst env set DATABASE_CLIENT=postgres DATABASE_URL=<connection string>
npx ezhst build dockerfile set -f Dockerfile
npx ezhst env import .env
npx ezhst deploy

Things to watch with npm

npm ci fails if the lockfile and package.json disagree. Run npm install locally and deploy again. npm 11 lockfiles may need a newer base image, such as node:24-alpine.

Commit package-lock.json, because a frozen install fails without it. To change the install step, edit the Dockerfile and upload it again with ezhst build dockerfile set -f Dockerfile.

Next steps

See the Strapi hub for every Strapi guide, or free Strapi hosting for what is included.

Frequently asked questions

How do I change the npm install command?

Edit the install line in your Dockerfile, upload it with ezhst build dockerfile set -f Dockerfile, then run ezhst redeploy.

Start for free

Install the skill, choose Global or Local, then tell your agent to deploy. No credit card, no config files.

$npx ezhst skill install