Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: consolidate debug Dockerfile with multi-stage build #34

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
heronimus marked this conversation as resolved.
Show resolved Hide resolved
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
Loading