Skip to content

Commit

Permalink
babylond image
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianElvis committed Dec 11, 2024
1 parent f804fc5 commit af50727
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ vendor/
coverage.txt

demo/build/

tmp/
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,19 @@ proto-lint:
proto-all proto-format proto-swagger-gen proto-lint

###############################################################################
### Images ###
### Integration e2e ###
###############################################################################

PACKAGES_E2E=$(shell go list ./... | grep '/e2e')

build-ibcsim-bcd:
$(MAKE) -C contrib/images build-ibcsim-bcd
$(MAKE) -C contrib/images ibcsim-bcd

build-babylond:
$(MAKE) -C contrib/images babylond

start-bcd-consumer-integration:
$(MAKE) -C contrib/images start-bcd-consumer-integration

test-e2e-bcd-consumer-integration: start-bcd-consumer-integration
go test -run TestBCDConsumerIntegrationTestSuite -mod=readonly -timeout=60m -v $(PACKAGES_E2E) --tags=e2e
10 changes: 8 additions & 2 deletions contrib/images/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
BABYLON_SDK_FULL_PATH := $(shell git rev-parse --show-toplevel)

build-ibcsim-bcd:
babylond: babylond-rmi
docker build --tag babylonlabs-io/babylond -f babylond/Dockerfile ${BABYLON_SDK_FULL_PATH}

babylond-rmi:
docker rmi babylonlabs-io/babylond --force 2>/dev/null; true

ibcsim-bcd:
docker build --tag babylonlabs-io/ibcsim-bcd -f ibcsim-bcd/Dockerfile ${BABYLON_SDK_FULL_PATH}

ibcsim-bcd-rmi:
Expand All @@ -14,4 +20,4 @@ stop-bcd-consumer-integration:
docker compose -f ibcsim-bcd/docker-compose.yml down
rm -rf ibcsim-bcd/.testnets

.PHONY: build-ibcsim-bcd ibcsim-bcd-rmi start-bcd-consumer-integration stop-bcd-consumer-integration
.PHONY: ibcsim-bcd ibcsim-bcd-rmi start-bcd-consumer-integration stop-bcd-consumer-integration babylond babylond-rmi
64 changes: 64 additions & 0 deletions contrib/images/babylond/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM golang:1.23-alpine AS build-env

# Customize to your build env

# TARGETPLATFORM should be one of linux/amd64 or linux/arm64.
ARG TARGETPLATFORM="linux/amd64"
# Version to build. Default is empty
ARG VERSION="base/consumer-chain-support"
ARG BABYLON_BUILD_OPTIONS=""
ARG COSMOS_BUILD_OPTIONS=""

# Use muslc for static libs
ARG BUILD_TAGS="muslc"
ARG LEDGER_ENABLED="false"


# Install cli tools for building and final image
RUN apk add --update --no-cache make git bash gcc linux-headers eudev-dev ncurses-dev openssh curl jq
RUN apk add --no-cache musl-dev

# Build
WORKDIR /go/src/github.com/babylonlabs-io/babylon
# Clone repo
RUN git clone https://github.com/babylonlabs-io/babylon.git /go/src/github.com/babylonlabs-io/babylon
# If version is set, then checkout this version
RUN if [ -n "${VERSION}" ]; then \
git fetch origin tag ${VERSION} --no-tags ; \
git checkout -f ${VERSION}; \
fi

# Cosmwasm - Download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | cut -d ' ' -f 2) && \
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)

RUN LEDGER_ENABLED=$LEDGER_ENABLED \
BABYLON_BUILD_OPTIONS=$BABYLON_BUILD_OPTIONS \
COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \
BUILD_TAGS=$BUILD_TAGS \
LINK_STATICALLY=true \
make build

FROM alpine:3.14 AS run
# Create a user
RUN addgroup --gid 1137 -S babylon && adduser --uid 1137 -S babylon -G babylon
RUN apk add bash curl jq

# Label should match your github repo
ARG VERSION
LABEL org.opencontainers.image.source="https://github.com/babylonlabs-io/babylond:${VERSION}"

# Install Libraries
# COPY --from=build-env /usr/lib/libgcc_s.so.1 /lib/
# COPY --from=build-env /lib/ld-musl*.so.1* /lib

COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/build/babylond /bin/babylond

# Set home directory and user
WORKDIR /home/babylon
RUN chown -R babylon /home/babylon
USER babylon

0 comments on commit af50727

Please sign in to comment.