Improve debug configuration.
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Linting and tests / Linting (push) Successful in 5s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Linting and tests / Linting (push) Successful in 5s
				
			This commit is contained in:
		
							
								
								
									
										5
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.vscode/launch.json
									
									
									
									
										vendored
									
									
								
							| @@ -16,10 +16,11 @@ | ||||
|             "substitutePath": [ | ||||
|                 { | ||||
|                     "from": "${workspaceFolder}", | ||||
|                     "to": "bunker" | ||||
|                     "to": "/bunkerd/" | ||||
|                 } | ||||
|             ], | ||||
|             "preLaunchTask": "Run bunkerd debug build" | ||||
|             "preLaunchTask": "Run bunkerd debug build", | ||||
|             "postDebugTask": "Stop bunkerd debug build" | ||||
|         } | ||||
|     ] | ||||
| } | ||||
|   | ||||
							
								
								
									
										17
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								.vscode/tasks.json
									
									
									
									
										vendored
									
									
								
							| @@ -4,9 +4,22 @@ | ||||
|         { | ||||
|             "label": "Run bunkerd debug build", | ||||
|             "type": "shell", | ||||
|             "command": "task server:localdev:bunkerd:stop; task server:localdev:bunkerd:build-debug && task server:localdev:bunkerd:restart-debug", | ||||
|             "command": "task server:localdev:bunkerd:down; task server:localdev:bunkerd:up-debug", | ||||
|             "group": { | ||||
|                 "kind": "test", | ||||
|                 "kind": "build", | ||||
|                 "isDefault": true | ||||
|             }, | ||||
|             "presentation": { | ||||
|                 // Do not open terminal every time debug is launched. | ||||
|                 "reveal": "silent" | ||||
|             } | ||||
|         }, | ||||
|         { | ||||
|             "label": "Stop bunkerd debug build", | ||||
|             "type": "shell", | ||||
|             "command": "task server:localdev:bunkerd:down-debug", | ||||
|             "group": { | ||||
|                 "kind": "build", | ||||
|                 "isDefault": true | ||||
|             }, | ||||
|             "presentation": { | ||||
|   | ||||
| @@ -2,15 +2,17 @@ FROM code.pztrn.name/containers/go-toolbox:v8 AS build | ||||
|  | ||||
| WORKDIR /bunkerd | ||||
| COPY . /bunkerd | ||||
| RUN --mount=type=cache,target="/home/container/go" task server:cmd:bunkerd:build --force | ||||
| RUN --mount=type=cache,target="/home/container/go" GOFLAGS="" task server:cmd:bunkerd:build-debug --force | ||||
|  | ||||
| FROM debian:13-slim | ||||
|  | ||||
| RUN apt-get update && \ | ||||
|     apt-get install -y ca-certificates iputils-ping coreutils && \ | ||||
|     apt-get install -y ca-certificates iputils-ping coreutils curl net-tools && \ | ||||
|     rm -rf /var/lib/apt/* /var/cache/apt/* | ||||
|  | ||||
| COPY --from=build /bunkerd/_build/bunkerd /bunkerd | ||||
| COPY --from=build /usr/local/bin/dlv /dlv | ||||
|  | ||||
| HEALTHCHECK --interval=1s --timeout=10s --start-period=1s --retries=3 CMD netstat -an | grep 4000 > /dev/null; if [ 0 != $? ]; then exit 1; fi; | ||||
|  | ||||
| ENTRYPOINT ["/dlv", "--listen=:4000", "--headless=true", "--log=true", "--accept-multiclient", "--api-version=2", "exec", "/bunkerd"] | ||||
|   | ||||
| @@ -20,6 +20,24 @@ tasks: | ||||
|       - ./_build/bunkerd{{exeExt}} | ||||
|     method: timestamp | ||||
|  | ||||
|   build-debug: | ||||
|     desc: "Builds bunkerd binary." | ||||
|     cmds: | ||||
|       - task: :::ensure-builddir | ||||
|       - task: cleanup | ||||
|       - go build -ldflags="{{ .BASIC_LDFLAGS }}" --gcflags "all=-N -l" -o _build/bunkerd{{exeExt}} ./server/cmd/bunkerd/main.go | ||||
|     sources: | ||||
|       - ./Taskfile.yml | ||||
|       - ./go.mod | ||||
|       - ./commons/* | ||||
|       - ./server/**/*.go | ||||
|       - ./server/Taskfile.yml | ||||
|       - ./server/**/Taskfile.yml | ||||
|       - ./server/entrypoint.sh | ||||
|     generates: | ||||
|       - ./_build/bunkerd{{exeExt}} | ||||
|     method: timestamp | ||||
|  | ||||
|   cleanup: | ||||
|     desc: "Deletes bunkerd binary from local build cache." | ||||
|     cmds: | ||||
|   | ||||
| @@ -87,5 +87,5 @@ tasks: | ||||
|     dir: "./server/localdevzone/bunkerd" | ||||
|     cmds: | ||||
|       - task: :common:network-up | ||||
|       - task: build | ||||
|       - docker compose -p bunkerd-debug -f docker-compose.debug.yaml up -d | ||||
|       - task: build-debug | ||||
|       - docker compose -p bunkerd-debug -f docker-compose.debug.yaml up -d --wait | ||||
|   | ||||
		Reference in New Issue
	
	Block a user