|
| 1 | +/* |
| 2 | +Gebug is a tool that makes debugging of Dockerized Go applications super easy by enabling Debugger and Hot-Reload features, seamlessly. |
| 3 | +
|
| 4 | +
|
| 5 | +The implementation is based on utilizing Docker and Docker-Compose to manage the debugging environment. |
| 6 | +In order to get a consistent and clean environment, the application build is taking place inside a Docker container. |
| 7 | +This make the debugging process agnostic to the host's libraries and tools versions. For instance, you can choose to work a specific |
| 8 | +version of Go on your host, but use another one when debugging your application. |
| 9 | +
|
| 10 | +
|
| 11 | +How it works |
| 12 | +
|
| 13 | +During the `init` process, the user sets the desired configuration to the project including |
| 14 | +Docker base, environment variables and expose ports. |
| 15 | +When the user runs `start` (unless explicitly asked) a `Dockerfile` and `docker-compose.yml` with the relevant configuration |
| 16 | +including one-direction source files synchronization between the host and the runtime container and auto-build on each change detected. |
| 17 | +
|
| 18 | +Configurations |
| 19 | +
|
| 20 | +
|
| 21 | +
|
| 22 | + output_binary - output binary artifact inside the runtime container (default: "/app") |
| 23 | + build_command - build command inside the runtime container (default: "go build -o {{.output_binary}}") |
| 24 | + run_command - run command, probably most of the time will just be the binary artifact path (default: "{.output_binary}}") |
| 25 | + runtime_image - base Docker image for the runtime container (default: "golang:1.14") |
| 26 | + debugger_enabled - whether to enable delve debugger inside the container or just use hot-reload (default: false) |
| 27 | + debugger_port - delve debugger listen port, relevant only if debugger_enabled was set (default: 40000) |
| 28 | + expose_ports - list of ports to expose inside the container (default: []) |
| 29 | + networks - list of docker external networks to join. if no network is selected, a new one will be created (default: []) |
| 30 | + environment - list of environment variables to be set inside the container (default: []) |
| 31 | +
|
| 32 | +
|
| 33 | +Notes & Tips |
| 34 | +
|
| 35 | + - Note you can reference other configuration fields. |
| 36 | + - When enabling Debugger -gcflags="all=-N -l" will be appended to the build command to stop compiler optimization and symbol removing. |
| 37 | + - No need to add the delve debugger listen port as it will be auto-added |
| 38 | + - Expose ports use the same syntax as docker-compose for mapping between host and container ports (e.g: "8080:8080") |
| 39 | + - Environment variables syntax: FOO=BAR or just FOO which will take the variable FOO from host and set it with its value |
| 40 | +
|
| 41 | +*/ |
| 42 | +package main |
0 commit comments