-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.debug
More file actions
41 lines (33 loc) · 1.55 KB
/
Dockerfile.debug
File metadata and controls
41 lines (33 loc) · 1.55 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
# Produces an image that runs cloud-init under a debugger. To use, build and push
# to a registry with:
#
# docker buildx build -f Dockerfile.debug --load -t my-docker-tag:my-revision .
#
# and configure your deployment to use that image. Disable any liveness checks
# (when the debugger is paused, service readiness/liveness endpoints will not respond,
# and watchdogs will perceive the container as dead) and connect to the debugger listen:
#
# dlv connect container-hostname.example:2345
FROM golang:1.24-bookworm
# Configure go env
ENV GOPATH=/usr/local/golib
RUN export GOPATH=$GOPATH
RUN go env -w GO111MODULE=auto
RUN export CGO_ENABLED=0
# Copy source files
COPY cmd $GOPATH/src/github.com/OpenCHAMI/cloud-init/cmd
COPY docs $GOPATH/src/github.com/OpenCHAMI/cloud-init/docs
COPY pkg $GOPATH/src/github.com/OpenCHAMI/cloud-init/pkg
COPY internal $GOPATH/src/github.com/OpenCHAMI/cloud-init/internal
COPY go.mod $GOPATH/src/github.com/OpenCHAMI/cloud-init/go.mod
COPY go.sum $GOPATH/src/github.com/OpenCHAMI/cloud-init/go.sum
# Build the image
RUN go build -C $GOPATH/src/github.com/OpenCHAMI/cloud-init/cmd/cloud-init-server -v \
-gcflags=all="-N -l" \
-o /usr/local/bin/cloud-init-server
RUN ln -s /usr/local/bin/cloud-init-server /cloud-init-server
RUN go install github.com/go-delve/delve/cmd/dlv@v1.24.0
RUN apt update; apt install tini
USER 65534:65534
ENTRYPOINT ["tini", "--"]
CMD ["/usr/local/golib/bin/dlv", "exec", "--continue", "--accept-multiclient", "--headless", "--api-version=2", "--listen=:2345", "--log", "/usr/local/bin/cloud-init-server"]