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

feat: coinbase accurate dockerfile #70

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.20.7
52 changes: 40 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,50 @@
FROM golang:1.20 AS build-env
# ------------------------------------------------------------------------------
# Build gaia
# ------------------------------------------------------------------------------
FROM golang:1.20 AS cosmos

# Set working directory for the build
WORKDIR /go/src/github.com/cosmos/rosetta
ARG COSMOS_VERSION

RUN git clone https://github.com/cosmos/cosmos-sdk \
/go/src/github.com/cosmos/cosmos-sdk

WORKDIR /go/src/github.com/cosmos/cosmos-sdk

RUN git checkout v0.50.2 && make build
RUN export SIMD_BIN=/go/src/github.com/cosmos/cosmos-sdk/build/simd && make init-simapp

# ------------------------------------------------------------------------------
# Build rosetta
# ------------------------------------------------------------------------------
FROM golang:1.21.5 AS rosetta

# optimization: if go.sum didn't change, docker will use cached image
COPY go.mod go.sum ./
ARG ROSETTA_VERSION

RUN go mod download
RUN git clone https://github.com/cosmos/rosetta.git \
/go/src/github.com/cosmos/rosetta

# Add source files
COPY . .
WORKDIR /go/src/github.com/cosmos/rosetta

RUN git checkout $ROSETTA_VERSION && \
go mod download

RUN make build
RUN make plugin
RUN cd plugins/cosmos-hub && make plugin

COPY --from=cosmos \
/go/src/github.com/cosmos/cosmos-sdk/build/simd \
/app/simd

COPY --from=cosmos \
/root/.simapp \
/root/.simapp

ADD scripts/entrypoint.sh /scripts/entrypoint.sh
RUN chmod +x /scripts/entrypoint.sh
raynaudoe marked this conversation as resolved.
Show resolved Hide resolved

EXPOSE 9650
EXPOSE 9651
EXPOSE 8080

# Run simd by default
CMD ["./rosetta", "--blockchain", "app", "--network", "network", "--tendermint", "cosmos:26657", "--grpc", "cosmos:9090", "--addr", ":8080"]
ENTRYPOINT ["./rosetta"]
ENTRYPOINT ["sh","/scripts/entrypoint.sh"]
STOPSIGNAL SIGTERM
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

all: build

rosetta:
build:
cd plugins/cosmos-hub && make plugin
go build -mod=readonly ./cmd/rosetta

build:
rosetta:
go build -mod=readonly ./cmd/rosetta

plugin:
bizk marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
5 changes: 5 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/app/simd start &
until curl --output /dev/null --silent --head --fail http://localhost:26657/health; do
sleep 1
done
./rosetta --blockchain "cosmos" --network "cosmos" --tendermint "tcp://localhost:26657" --addr "localhost:8080" --grpc "localhost:9090"
Loading