I've tried everything and nothing has solved my hot reload problem, the containers will load normally and the code will be built, however, after modifying the code, the code will change, but the air package won't do any rebuilds.
This state does not change if edit some code.
if run locally everything works fine.
Dockerfile:
FROM golang:alpine
ENV GO111MODULE=on
EXPOSE 8080
RUN mkdir /app
WORKDIR /app
COPY go.mod .
COPY go.sum .
RUN go mod download
RUN go get github.com/cosmtrek/air
COPY . .
ENTRYPOINT ["air", "-c", ".air.toml"]
docker-compose.yml
go:
container_name: go
build:
dockerfile: Dockerfile
context: ./
volumes:
- ./:/app
ports:
- '8080:8080'
.air.toml
root = "."
testdata_dir = "testdata"
tmp_dir = "tmp"
[build]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main ."
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
full_bin = ""
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0s"
log = "build-errors.log"
send_interrupt = false
stop_on_error = true
[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"
[log]
time = false
[misc]
clean_on_exit = false
[screen]
clear_on_rebuild = false