Deploy with Docker
Goal: an image of the app that runs anywhere Docker does.
- Run
hamur build --docker. It builds as usual and writes aDockerfileand a.dockerignoreat the app root. It works with thebunandnodepresets; any other preset stops before the build. Copy yourbun.locknext topackage.json, since the image installs with--frozen-lockfile. - Build and run the image. The container listens on port 3000. Pass the app key and every other secret at run time: the
.dockerignorekeeps.env*out of the image. A volume on/app/.datakeeps the development-default SQLite file and the disk blobs.
hamur build --docker
docker build -t my-app .
docker run -p 3000:3000 -e HAMUR_KEY="$HAMUR_KEY" -v my-app-data:/app/.data my-app
- The image has a
HEALTHCHECKthat requests/, so an orchestrator can tell a running container from a healthy one.
A Dockerfile that exists is never overwritten, so edit the generated one freely: the build prints Dockerfile exists; left as is. To run on Node instead of Bun, build with --preset node.
See also: Docker, Bun preset, Node preset, Deploy to Fly.io.