Skip to content

Commit

Permalink
docker: set up Dockerfile for bcd (#10)
Browse files Browse the repository at this point in the history
This PR fixes the `Dockerfile` for the `bcd` program. It is the
prerequisite for the Euphrates 0.3.0 local deployment.

Test plan: `sudo make build-docker`
  • Loading branch information
SebastianElvis authored Jun 14, 2024
1 parent 4f27c48 commit 439aae4
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 854 deletions.
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
FROM golang:1.20-alpine3.17 AS go-builder
FROM golang:1.21.4-alpine AS go-builder

RUN apk add --no-cache ca-certificates build-base git

WORKDIR /code

# Download dependencies and CosmWasm libwasmvm if found.
ADD demo/go.mod demo/go.sum ./
# Copy over code
COPY . /code

#ADD https://github.com/CosmWasm/wasmvm/releases/download/v$wasmvm/libwasmvm_muslc.$arch.a /lib/libwasmvm_muslc.$arch.a
## Download
RUN set -eux; \
WASM_VERSION=v$(go list -m github.com/CosmWasm/wasmvm | cut -d" " -f2 | cut -d"v" -f2); \
echo $WASM_VERSION; \
wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.$(uname -m).a

# Copy over code
COPY . /code
RUN WASMVM_VERSION=$(grep github.com/CosmWasm/wasmvm demo/go.mod | cut -d' ' -f2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.$(uname -m).a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.$(uname -m).a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1)

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /code/bin/bcd
# then ensure static linking
RUN cd demo/ && LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
&& file /code/demo/build/bcd \
&& echo "Ensuring binary is statically linked ..." \
&& (file /code/demo/build/bcd | grep "statically linked")
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ build:

build-linux-static:
$(MAKE) -C demo build-linux-static
$(MAKE) -C tests/e2e build-linux

build-docker:
$(DOCKER) build --tag babylonchain/bcd -f Dockerfile \
$(shell git rev-parse --show-toplevel)

########################################
### Testing
Expand Down
10 changes: 5 additions & 5 deletions demo/cmd/bcd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/babylonchain/babylon-sdk/demo/app"
"github.com/babylonchain/babylon-sdk/demo/app/params"
tmcfg "github.com/cometbft/cometbft/config"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/cosmos-sdk/client"
Expand All @@ -31,9 +33,6 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/babylonchain/babylon-sdk/demo/app"
"github.com/babylonchain/babylon-sdk/demo/app/params"
)

// NewRootCmd creates a new root command for wasmd. It is called once in the
Expand Down Expand Up @@ -150,6 +149,7 @@ func initRootCmd(rootCmd *cobra.Command, basicManager module.BasicManager) {
// add keybase, auxiliary RPC, query, and tx child commands
rootCmd.AddCommand(
server.StatusCommand(),
genesisCommand(),
queryCommand(),
txCommand(),
keys.Commands(),
Expand All @@ -164,10 +164,10 @@ func addModuleInitFlags(startCmd *cobra.Command) {
// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter
//
//nolint:unused // ignore unused code linting
func genesisCommand(encodingConfig params.EncodingConfig, cmds ...*cobra.Command) *cobra.Command {
func genesisCommand(cmds ...*cobra.Command) *cobra.Command {
tempApp := app.NewTmpApp()

cmd := genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, tempApp.BasicModuleManager, app.DefaultNodeHome)
cmd := genutilcli.GenesisCoreCommand(tempApp.TxConfig(), tempApp.BasicModuleManager, app.DefaultNodeHome)

for _, subCmd := range cmds {
cmd.AddCommand(subCmd)
Expand Down
40 changes: 19 additions & 21 deletions demo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/stretchr/testify v1.9.0
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/grpc v1.64.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

Expand All @@ -49,11 +49,10 @@ require (
)

require (
cloud.google.com/go v0.112.0 // indirect
cloud.google.com/go/compute v1.24.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/compute/metadata v0.3.0 // indirect
cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/storage v1.37.0 // indirect
cloud.google.com/go/storage v1.38.0 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/core v0.11.0 // indirect
cosmossdk.io/depinject v1.0.0-alpha.4 // indirect
Expand Down Expand Up @@ -117,7 +116,7 @@ require (
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/gorilla/handlers v1.5.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
Expand Down Expand Up @@ -181,26 +180,25 @@ require (
github.com/zondax/ledger-go v0.14.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/term v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/api v0.162.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/api v0.169.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240513163218-0867130af1f8 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
Expand Down
Loading

0 comments on commit 439aae4

Please sign in to comment.