-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathDockerfile.debug
More file actions
47 lines (35 loc) · 1.31 KB
/
Dockerfile.debug
File metadata and controls
47 lines (35 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# ================================
# STAGE 1: Build debug binary + dlv
# ================================
FROM golang:1.25.7-alpine AS builder
RUN apk add --no-cache gcc musl-dev make sqlite-dev git
WORKDIR /home/aigent/repos/aggkit
COPY go.mod go.sum ./
RUN go mod download
COPY . .
# Install delve
RUN go install github.com/go-delve/delve/cmd/dlv@latest
# Build debug binary (disable inlining and optimizations for proper debugging)
RUN CGO_ENABLED=1 go build \
-gcflags="all=-N -l" \
-o /out/aggkit \
./cmd
# ================================
# STAGE 2: Debug runtime image
# ================================
FROM alpine:3.22
RUN apk add --no-cache sqlite-libs ca-certificates \
&& addgroup -S appgroup \
&& adduser -S appuser -G appgroup
COPY --from=builder /go/bin/dlv /usr/local/bin/dlv
COPY --from=builder /out/aggkit /usr/local/bin/aggkit
# Run as non-root. Note: the container must be started with
# --cap-add=SYS_PTRACE so that delve can trace the target process.
USER appuser
EXPOSE 5576/tcp
EXPOSE 40000/tcp
# Default: run aggkit under delve headless. App args are provided by
# the compose file's `command:` block (appended after the `--` separator).
CMD ["dlv", "exec", "/usr/local/bin/aggkit", \
"--headless", "--listen=:40000", "--api-version=2", \
"--accept-multiclient", "--log"]