Skip to content

Commit

Permalink
chore: consolidate debug Dockerfile with multi-stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
heronimus committed Jan 15, 2024
1 parent 71de882 commit c0d1c6e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 184 deletions.
16 changes: 0 additions & 16 deletions .ide-debug/Dockerfile.debug

This file was deleted.

12 changes: 12 additions & 0 deletions .ide-debug/compose.debug.override.yml
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"
160 changes: 0 additions & 160 deletions .ide-debug/docker-compose.debug.yml

This file was deleted.

20 changes: 17 additions & 3 deletions cardinal/Dockerfile
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"]
12 changes: 7 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ version: "3"
services:
cardinal:
container_name: cardinal
build: ./cardinal
build:
context: ./cardinal
target: runtime
depends_on:
- redis
expose:
Expand All @@ -21,13 +23,13 @@ services:
evm:
container_name: evm_base_shard
environment:
# DA_AUTH_TOKEN is obtained from celestia client and passed in from world.toml.
# DA_AUTH_TOKEN is obtained from celestia client and passed in from world.toml.
# See https://docs.celestia.org/developers/node-tutorial#auth-token
- DA_AUTH_TOKEN=${DA_AUTH_TOKEN:-}
- DA_AUTH_TOKEN=${DA_AUTH_TOKEN:-}
- DA_BASE_URL=${DA_BASE_URL:-http://celestia-devnet:26658}
- DA_NAMESPACE_ID=${DA_NAMESPACE_ID:-67480c4a88c4d12935d4}
- CHAIN_ID=${CHAIN_ID:-world-engine}
# KEY_MNEMONIC is a test mnemonic and should not be used in production.
# KEY_MNEMONIC is a test mnemonic and should not be used in production.
# This mnemonic can be overwritten by setting the KEY_MNEMONIC environment variable.
- KEY_MNEMONIC=${KEY_MNEMONIC:-enact adjust liberty squirrel bulk ticket invest tissue antique window thank slam unknown fury script among bread social switch glide wool clog flag enroll}
- FAUCET_ADDR=${FAUCET_ADDR:-world142fg37yzx04cslgeflezzh83wa4xlmjpms0sg5}
Expand Down Expand Up @@ -143,7 +145,7 @@ services:
ports:
- "6379:6379"
restart: always

celestia-devnet:
container_name: celestia_devnet
image: ghcr.io/rollkit/local-celestia-devnet:v0.12.1
Expand Down

0 comments on commit c0d1c6e

Please sign in to comment.