Skip to content

Deploy with Docker

Goal: an image of the app that runs anywhere Docker does.

  1. Run hamur build --docker. It builds as usual and writes a Dockerfile and a .dockerignore at the app root. It works with the bun and node presets; any other preset stops before the build. Copy your bun.lock next to package.json, since the image installs with --frozen-lockfile.
  2. Build and run the image. The container listens on port 3000. Pass the app key and every other secret at run time: the .dockerignore keeps .env* out of the image. A volume on /app/.data keeps the development-default SQLite file and the disk blobs.
sh
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
  1. The image has a HEALTHCHECK that 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.