From 4e0223052e4176227ff009c3a25835f45ce05e73 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Fri, 24 Jul 2026 12:01:20 -0400 Subject: [PATCH] Updated Docker configs to use Air for auto-reloading --- .air.toml | 21 +++++++++++++++++++++ Dockerfile.dev | 6 ++++++ Makefile | 4 ++++ docker-dev.yml | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .air.toml diff --git a/.air.toml b/.air.toml new file mode 100644 index 0000000..b79a6e9 --- /dev/null +++ b/.air.toml @@ -0,0 +1,21 @@ +[build] + # Tell Air to use your Makefile build target directly! + cmd = "make build BUILD_DIR=/tmp" + + # Tell Air where your compiled binary ends up + bin = "/tmp/blt" + + # Watch these extensions and ignore these paths + include_ext = ["go", "tpl", "tmpl", "html"] + exclude_dir = ["assets", "tmp", "bin", "node_modules", "public"] + + # Delay before rebuilding after a file save (ms) + delay = 500 + +[log] + time = false + +[color] + main = "magenta" + build = "yellow" + runner = "green" diff --git a/Dockerfile.dev b/Dockerfile.dev index e3ea210..2f3529c 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -4,8 +4,14 @@ WORKDIR /app RUN apt install -y make gcc +# Make sure /app is safe regardless of who owns it +RUN git config --global --add safe.directory /app + ENV CGO_ENABLED=1 +# Install Air for auto-reloading +RUN go install github.com/air-verse/air@latest + # Copy dependency definitions first (caching optimization) COPY go.mod go.sum ./ RUN go mod download diff --git a/Makefile b/Makefile index d89e400..09e0fc0 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ build: run: $(BUILD_DIR)/$(NAME) +watch: + @echo "Starting hot-reload watcher..." + @air + .PHONY: help all: help # help: show this help message diff --git a/docker-dev.yml b/docker-dev.yml index 01b0f6b..37b1e65 100644 --- a/docker-dev.yml +++ b/docker-dev.yml @@ -3,7 +3,7 @@ services: build: context: . dockerfile: Dockerfile.dev - command: make run BUILD_DIR=/tmp + command: make watch ports: - "2830:2830" volumes: