-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: consolidate debug Dockerfile with multi-stage build
- Loading branch information
Showing
5 changed files
with
36 additions
and
184 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
## Merge with docker-compose.yml in the root directory. | ||
|
||
## Override Docker Cardinal services build target for debugging purposes | ||
## and add container capabilities (cap_add) and security_opt | ||
services: | ||
cardinal: | ||
build: | ||
target: runtime-debug | ||
cap_add: | ||
- SYS_PTRACE | ||
security_opt: | ||
- "seccomp:unconfined" |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
# Base Builder Stage | ||
FROM golang:1.21 AS builder | ||
|
||
WORKDIR /usr/src/app | ||
RUN go install github.com/go-delve/delve/cmd/dlv@latest | ||
|
||
copy . . | ||
WORKDIR /usr/src/app | ||
COPY . . | ||
|
||
RUN go build -v -o /usr/local/bin/app | ||
RUN go build -gcflags="all=-N -l" -v -o /usr/local/bin/app-debug | ||
|
||
# Runtime Debug Stage | ||
FROM ubuntu:22.04 AS runtime-debug | ||
|
||
COPY --from=builder /go/bin/dlv /usr/local/bin | ||
COPY --from=builder /usr/local/bin/app-debug /usr/local/bin/ | ||
|
||
CMD ["dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "/usr/local/bin/app-debug"] | ||
|
||
|
||
# Runtime Stage | ||
FROM ubuntu:22.04 AS runtime | ||
|
||
FROM ubuntu:22.04 | ||
COPY --from=builder /usr/local/bin/app /usr/local/bin/ | ||
|
||
CMD ["app"] |
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