# Deploy a AdonisJS app that uses pnpm

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

## What your Dockerfile runs

| Step | Dockerfile line |
| --- | --- |
| Copy the manifests | `COPY package.json pnpm-lock.yaml ./` |
| Install | `RUN corepack enable pnpm && pnpm install --frozen-lockfile` |
| Build | `node ace build`, in the Dockerfile build step |
| Start | `node build/bin/server.js` |

Run scripts with `pnpm 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 pnpm-lock.yaml ./
RUN corepack enable pnpm && pnpm install --frozen-lockfile
COPY . .
RUN --mount=type=secret,id=appenv,target=/run/secrets/appenv sh -c 'set -a; . /run/secrets/appenv; set +a; node ace build'
ENV NODE_ENV=production PORT=3000 HOST=0.0.0.0
EXPOSE 3000
CMD ["node", "build/bin/server.js"]
```

## Deploy

Change the Node.js template's build step to `node ace build` and its last line to `node build/bin/server.js`. Set `APP_KEY`, `LOG_LEVEL` and `SESSION_DRIVER` if your `start/env.ts` requires them.

```
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_KEY=<key> LOG_LEVEL=info
npx ezhst build dockerfile set -f Dockerfile
npx ezhst env import .env
npx ezhst deploy
```

## Things to watch with pnpm

Corepack uses the version in the `packageManager` field when you set one. A stale lockfile fails `--frozen-lockfile`.

Commit `pnpm-lock.yaml`, 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 [AdonisJS hub](/frameworks/adonisjs) for every AdonisJS guide, or [free AdonisJS hosting](/free-adonisjs-hosting) for what is included.

## Frequently asked questions

### How do I change the pnpm install command?

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