-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.debug
48 lines (33 loc) · 1.36 KB
/
Dockerfile.debug
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
48
# https://hub.docker.com/_/golang
FROM golang:1.22-bookworm AS build
# Ensure ca-certificates are up to date
RUN update-ca-certificates
# Set the current Working Directory inside the container
RUN mkdir /scratch
WORKDIR /scratch
# Prepare the folder where we are putting all the files
RUN mkdir /app
# Copy everything from the current directory to the PWD(Present Working Directory) inside the container
COPY . .
# Download go modules
RUN go mod download
RUN go mod verify
# Build the binary (disable inlining and optimizations that can interfere with debugging)
# WARNING: CGO_ENABLED=1 is required for sqlite to work, but it might cause problems with remote debugging
RUN CGO_ENABLED=1 go build -o /app/inx-indexer .
# Copy the assets
COPY ./config_defaults.json /app/config.json
############################
# Image
############################
FROM golang:1.22-bookworm
HEALTHCHECK --interval=10s --timeout=5s --retries=30 CMD [ "/app/inx-indexer", "tools", "health"]
## Install delve
RUN CGO_ENABLED=0 go install -ldflags "-s -w -extldflags '-static'" github.com/go-delve/delve/cmd/dlv@latest
EXPOSE 9091/tcp
# Delve
EXPOSE 4000
# Copy the app dir into distroless image
COPY --from=build /app /app
WORKDIR /app
ENTRYPOINT [ "/go/bin/dlv", "--listen=:4000", "--headless=true", "--log=true", "--accept-multiclient", "--api-version=2", "exec", "/app/inx-indexer", "--" ]