|
| 1 | +########## |
| 2 | +# Builder # |
| 3 | +########## |
| 4 | +FROM golang:1.24-bookworm AS builder |
| 5 | + |
| 6 | +ARG IGNITE_VERSION=latest |
| 7 | +ARG IGNITE_EVOLVE_APP_VERSION=main |
| 8 | +ARG EVNODE_VERSION=v1.0.0-beta.2 |
| 9 | + |
| 10 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 11 | + git curl bash ca-certificates make gcc musl-dev && \ |
| 12 | + rm -rf /var/lib/apt/lists/* |
| 13 | + |
| 14 | +# Install Ignite CLI at requested version |
| 15 | +RUN curl -sSL https://get.ignite.com/cli@${IGNITE_VERSION}! | bash |
| 16 | + |
| 17 | +WORKDIR /workspace |
| 18 | + |
| 19 | +# Copy ev-abci repo (root) |
| 20 | +COPY . /workspace/ev-abci |
| 21 | + |
| 22 | +# Scaffold GM app and apply evolve plugin |
| 23 | +RUN ignite scaffold chain gm --no-module --skip-git --address-prefix gm |
| 24 | +WORKDIR /workspace/gm |
| 25 | +RUN ignite app install github.com/ignite/apps/evolve@${IGNITE_EVOLVE_APP_VERSION} |
| 26 | +RUN ignite evolve add |
| 27 | + |
| 28 | +# Inject App wiring for ev-abci network module before building |
| 29 | +COPY .github/integration-tests/patches/app-wiring/patch-app-wiring.sh /workspace/patch-app-wiring.sh |
| 30 | +RUN chmod +x /workspace/patch-app-wiring.sh && \ |
| 31 | + echo "===== Running network module patch =====" && \ |
| 32 | + bash /workspace/patch-app-wiring.sh |
| 33 | + |
| 34 | + |
| 35 | +# Align module versions like in CI |
| 36 | +RUN go mod edit -replace github.com/evstack/ev-node=github.com/evstack/ev-node@${EVNODE_VERSION} \ |
| 37 | + && go mod edit -replace github.com/evstack/ev-abci=../ev-abci \ |
| 38 | + && go mod tidy |
| 39 | + |
| 40 | +# Build gmd binary |
| 41 | +ENV GOBIN=/workspace/bin |
| 42 | +RUN ignite chain build --skip-proto && \ |
| 43 | + test -x "${GOBIN}/gmd" |
| 44 | + |
| 45 | +############ |
| 46 | +# Runtime # |
| 47 | +############ |
| 48 | +FROM debian:bookworm-slim |
| 49 | + |
| 50 | +ENV DEBIAN_FRONTEND=noninteractive |
| 51 | + |
| 52 | +# Install runtime dependencies (include Go for Ignite operations) |
| 53 | +RUN apt-get update && apt-get install -y --no-install-recommends \ |
| 54 | + ca-certificates curl jq bash sudo netcat-openbsd golang git && \ |
| 55 | + rm -rf /var/lib/apt/lists/* |
| 56 | + |
| 57 | +# Create gm user and grant passwordless sudo |
| 58 | +RUN useradd -m -s /bin/bash gm && echo "gm ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers |
| 59 | + |
| 60 | +# Copy prebuilt gmd binary |
| 61 | +COPY --from=builder /workspace/bin/gmd /usr/local/bin/gmd |
| 62 | +RUN chmod +x /usr/local/bin/gmd |
| 63 | + |
| 64 | +# Copy Ignite CLI and plugin cache from builder |
| 65 | +COPY --from=builder /usr/local/bin/ignite /usr/local/bin/ignite |
| 66 | +COPY --from=builder /root/.ignite /home/gm/.ignite |
| 67 | +RUN chown -R gm:gm /home/gm/.ignite && chmod +x /usr/local/bin/ignite |
| 68 | + |
| 69 | +# Copy gm source (for ignite/evolve operations) |
| 70 | +COPY --from=builder --chown=gm:gm /workspace/gm /home/gm/gm |
| 71 | + |
| 72 | +# Copy scripts |
| 73 | +COPY --chown=gm:gm .github/integration-tests/scripts/init-gm.sh /home/gm/init-gm.sh |
| 74 | +COPY --chown=gm:gm .github/integration-tests/scripts/wait-for-da.sh /home/gm/wait-for-da.sh |
| 75 | +RUN chmod +x /home/gm/init-gm.sh /home/gm/wait-for-da.sh |
| 76 | + |
| 77 | +# Switch to gm user |
| 78 | +USER gm |
| 79 | +WORKDIR /home/gm |
| 80 | + |
| 81 | +# Set up environment |
| 82 | +ENV GM_HOME=/home/gm/.gm |
| 83 | +ENV CHAIN_ID=gm |
| 84 | +ENV MONIKER=gm-local |
| 85 | +ENV ATTESTER_MODE=false |
| 86 | + |
| 87 | +# Expose ports |
| 88 | +EXPOSE 26757 26756 9190 1417 |
| 89 | + |
| 90 | +# Health check |
| 91 | +HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ |
| 92 | + CMD curl -f http://localhost:26757/status || exit 1 |
| 93 | + |
| 94 | +# Default command |
| 95 | +CMD ["./init-gm.sh"] |
0 commit comments