diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-29 15:23:15 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-30 20:23:12 +0100 |
commit | dce2b495b931f82fbb8d1ff71ef661d77817307c (patch) | |
tree | 4783784b98ffe1602d668eed37bf634737acded5 /debug/dockerfile-debug | |
parent | b77dec0049ea1d23fc75e73866f2bdf305ad3433 (diff) |
Some tidying
Configured to run dlv in the container
See https://golangforall.com/en/post/go-docker-delve-remote-debug.html
Haven't actually go the interactive dlv working - need to explore docker
attach to do that, maybe.
Slimmed down image in play
- Also adds a new make rule to run debug container
Diffstat (limited to 'debug/dockerfile-debug')
-rw-r--r-- | debug/dockerfile-debug | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/debug/dockerfile-debug b/debug/dockerfile-debug new file mode 100644 index 0000000..296ab31 --- /dev/null +++ b/debug/dockerfile-debug @@ -0,0 +1,14 @@ +FROM golang:alpine as build + +WORKDIR / + +COPY . . + +RUN CGO_ENABLED=0 go install github.com/go-delve/delve/cmd/dlv@latest +#RUN CGO_ENABLED=0 go get -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv +RUN CGO_ENABLED=0 go build -gcflags "all=-N -l" -o ./app ./cmd/dbasik-api + +FROM scratch +COPY --from=build /go/bin/dlv /dlv +COPY --from=build /app /app +CMD ["/dlv"] |