Created
April 26, 2023 15:23
-
-
Save epomatti/e8f2892c87388e7d225f11429f190453 to your computer and use it in GitHub Desktop.
Go remote debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Commands | |
# docker build --tag godebug . | |
# docker run --security-opt="seccomp=unconfined" --cap-add=SYS_PTRACE -p:5001:5000 -p:2345:2345 godebug | |
FROM golang:1.19.2 | |
WORKDIR /usr/src/app | |
COPY go.mod go.* ./ | |
RUN go mod download && go mod verify | |
RUN go install github.com/go-delve/delve/cmd/dlv@latest | |
COPY . . | |
RUN go build -gcflags="all=-N -l" -v -o /usr/local/bin/app ./... | |
EXPOSE 2345 | |
EXPOSE 5001 | |
CMD ["dlv","debug","--listen=:2345","--headless=true","--api-version=2","--accept-multiclient"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment