Updated Docker configs to use Air for auto-reloading
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -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"
|
||||||
@@ -4,8 +4,14 @@ WORKDIR /app
|
|||||||
|
|
||||||
RUN apt install -y make gcc
|
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
|
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 dependency definitions first (caching optimization)
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ build:
|
|||||||
run:
|
run:
|
||||||
$(BUILD_DIR)/$(NAME)
|
$(BUILD_DIR)/$(NAME)
|
||||||
|
|
||||||
|
watch:
|
||||||
|
@echo "Starting hot-reload watcher..."
|
||||||
|
@air
|
||||||
|
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
all: help
|
all: help
|
||||||
# help: show this help message
|
# help: show this help message
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ services:
|
|||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile.dev
|
dockerfile: Dockerfile.dev
|
||||||
command: make run BUILD_DIR=/tmp
|
command: make watch
|
||||||
ports:
|
ports:
|
||||||
- "2830:2830"
|
- "2830:2830"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Reference in New Issue
Block a user