air-verse / air

☁️ Live reload for Go apps
GNU General Public License v3.0
16.38k stars 772 forks source link

Docker Container failed to remove app/tmp/main server, error: remove app/tmp/main: not a directory #504

Closed khanakia closed 7 months ago

khanakia commented 7 months ago

I am using air and it is running fine when I run it without a Docker container.

But when it tries to run it inside the Docker container it runs fine the first time. But when I update the code it does not work and gives the following error:

2023-11-20 20:00:44 building...
2023-11-20 20:00:44 failed to remove app/tmp/main server, error: remove app/tmp/main: not a directory
2023-11-20 20:00:45 running...

It seems it picking the wrong path as I have mounted the root directory as app so it should pick the path tmp/main not the app/tmp/main as app is running inside app directory

volumes:
      - .:/app

.air.toml

root = "."
tmp_dir = "tmp"

[build]
  bin = "./tmp/main server"
  cmd = "go build -o ./tmp/main ."
  delay = 2000
  exclude_dir = ["assets", "tmp", "vendor", "node_modules", "logs"]
  exclude_file = []
  exclude_regex = []
  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