Docker
Build one image and run it on any container host.
The kit ships a Dockerfile that builds a small, self-contained image
(Next.js standalone output). Use it for any host that runs containers —
Railway, Render, Fly.io, Coolify or Dokploy on your own server, and so on.
Finish the deployment checklist first: the production database, Clerk, and Stripe.
Build and run
NEXT_PUBLIC_* variables are written into the browser code when the
image is built, so they must be passed as build arguments. Setting them
only when the container starts has no effect. Every other variable is read
when the container starts.
docker build -t shiftfast \
--build-arg NEXT_PUBLIC_APP_URL=https://your-domain \
--build-arg NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_... \
--build-arg NEXT_PUBLIC_PRICE_PRO_MONTHLY=price_... \
--build-arg NEXT_PUBLIC_PRICE_PRO_YEARLY=price_... \
--build-arg NEXT_PUBLIC_PRICE_LIFETIME=price_... \
.
docker run -p 3000:3000 --env-file .env.production shiftfastAdd a --build-arg for each other NEXT_PUBLIC_* variable you use, such as
the Sentry or Formspree ones. .env.production holds every production
variable from Configuration. The app listens on port
3000.
The image never contains your secrets: the build runs with placeholder
server variables, and .env files are excluded from it.
Migrations
The container doesn't run migrations. Apply each one to production from your machine before deploying the code that needs it:
DIRECT_URL="<production direct URL>" pnpm db:migrateHosts
Point the host at your repository and it builds the Dockerfile itself. The
only host-specific part is making the NEXT_PUBLIC_* variables available
to the build:
| Host | Build-time variables |
|---|---|
| Railway | Service variables are passed to the build automatically. |
| Render | Environment variables are passed to the build automatically. |
| Fly.io | Add them under [build.args] in fly.toml; set the rest as secrets. |
| Coolify | Mark each NEXT_PUBLIC_* variable as a build variable. |
| Dokploy | Add them as build arguments, next to the environment variables. |
| DigitalOcean App Platform | Scope each NEXT_PUBLIC_* variable to Build time (or build and run). |
On any other host, build the image yourself with the command above, push it to a registry, and run it with the runtime variables set.