Add debugging support for Docker container. (#228)

This commit is contained in:
Thomas E Lackey 2023-01-25 16:10:29 -06:00 committed by GitHub
parent dec31761b2
commit b0bcdacc7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -4,6 +4,9 @@ RUN apk --update --no-cache add make git g++ linux-headers
# DEBUG # DEBUG
RUN apk add busybox-extras RUN apk add busybox-extras
# Include dlv
RUN go install github.com/go-delve/delve/cmd/dlv@latest
# Build ipld-eth-server # Build ipld-eth-server
WORKDIR /go/src/github.com/cerc-io/ipld-eth-server WORKDIR /go/src/github.com/cerc-io/ipld-eth-server
@ -46,4 +49,7 @@ COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-server/ipld-eth-server i
COPY --from=builder /goose goose COPY --from=builder /goose goose
COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-server/environments environments COPY --from=builder /go/src/github.com/cerc-io/ipld-eth-server/environments environments
# Allow for debugging
COPY --from=builder /go/bin/dlv /usr/local/bin/
ENTRYPOINT ["/app/entrypoint.sh"] ENTRYPOINT ["/app/entrypoint.sh"]

View File

@ -2,8 +2,13 @@
echo "Beginning the ipld-eth-server process" echo "Beginning the ipld-eth-server process"
echo running: ./ipld-eth-server ${VDB_COMMAND} --config=config.toml START_CMD="./ipld-eth-server"
./ipld-eth-server ${VDB_COMMAND} --config=config.toml if [ "true" == "$CERC_REMOTE_DEBUG" ] && [ -x "/usr/local/bin/dlv" ]; then
START_CMD="/usr/local/bin/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec `pwd`/ipld-eth-server --continue --"
fi
echo running: $START_CMD ${VDB_COMMAND} --config=`pwd`/config.toml
$START_CMD ${VDB_COMMAND} --config=`pwd`/config.toml
rv=$? rv=$?
if [ $rv != 0 ]; then if [ $rv != 0 ]; then