Run Hero in a Docker container for easy setup, consistent environments, and isolation from your host system.
Find a file
2025-12-10 12:16:08 -05:00
docs docs: Add instructions for pulling and running Docker images from registry 2025-12-10 12:16:08 -05:00
scripts chore: Move start.sh to scripts directory and update Dockerfile reference 2025-12-10 08:03:50 -05:00
.gitignore init 2025-12-10 07:59:59 -05:00
Dockerfile chore: Update Hero installation to always use latest release 2025-12-10 08:10:07 -05:00
README.md docs: Update README to reflect new Docker image name "hero_docker" 2025-12-10 08:15:02 -05:00

Hero Docker Container

Introduction

A Docker-based development environment for Hero development with essential tools and configurations. This container comes pre-installed with Bun, Redis, and the Hero CLI.

Prerequisites

  • Docker installed on your system
  • SSH keys for deploying Hero websites (if publishing)

Build the Image

Build the Docker image:

docker build -t hero_docker .

Run the Container

Run the container with an interactive shell, mounting your current directory as the workspace and your SSH keys:

docker run --network=host \
  -v $(pwd):/workspace \
  -v ~/.ssh:/root/ssh \
  -it hero_docker

By default, the container will:

  • Start Redis server in the background
  • Copy your SSH keys to the proper location
  • Initialize the SSH agent
  • Add your default SSH key (id_ed25519)

To use a different SSH key, specify it with the KEY environment variable (e.g. KEY=id_ed25519):

docker run --network=host \
  -v $(pwd):/workspace \
  -v ~/.ssh:/root/ssh \
  -e KEY=your_custom_key_name \
  -it hero_docker

Launch the Hero Website

To start a Hero Docusaurus website in development mode:

  • Build the book then close the prompt with Ctrl+C
    hero docs -d
    
  • See the book on the local browser
    bash /root/hero/var/docs/develop.sh
    

You can then view the website in your browser at https://localhost:3100.

Publish a Website

  • To build and publish a Hero website:
    • Development
      hero docs -bpd
      
    • Production
      hero docs -bp
      

If you want to specify a different SSH key, use -dk:

hero docs -bpd -dk ~/.ssh/id_ed25519

Note: The container handles the SSH agent and key management automatically on startup, so in most cases, you won't need to manually specify keys.