-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: bump wasmd and re-enable static linking (#213)
Resolves #26 Also addresses the GH action warning on Dockerfiles NOTE: `init.Dockerfile` still uses dynamic linking because it builds v0.9.3. This can only be fixed in the v2 upgrade, unless we release v0.9.4 with this PR backported (which I don't think it's the case).
- Loading branch information
1 parent
78581a7
commit b1a4b48
Showing
5 changed files
with
141 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,67 @@ | ||
FROM golang:1.21 AS build-env | ||
FROM golang:1.21-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 | ||
ARG BABYLON_BUILD_OPTIONS="" | ||
ARG LEDGER_ENABLED="false" | ||
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 | ||
# First cache dependencies | ||
COPY go.mod go.sum /go/src/github.com/babylonlabs-io/babylon/ | ||
RUN go mod download | ||
# Then copy everything else | ||
COPY ./ /go/src/github.com/babylonlabs-io/babylon/ | ||
|
||
# Handle if version is set | ||
# If version is set, then checkout this version | ||
RUN if [ -n "${VERSION}" ]; then \ | ||
git fetch origin tag ${VERSION} --no-tags; \ | ||
git checkout -f ${VERSION}; \ | ||
git fetch origin tag ${VERSION} --no-tags ; \ | ||
git checkout -f ${VERSION}; \ | ||
fi | ||
|
||
# Cache mod dependencies | ||
RUN go mod download | ||
# 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 \ | ||
LINK_STATICALLY=false \ | ||
BUILD_TAGS=$BUILD_TAGS \ | ||
LINK_STATICALLY=true \ | ||
make build | ||
|
||
FROM debian:bookworm-slim AS wasm-link | ||
|
||
ARG VERSION | ||
|
||
FROM alpine:3.14 AS run | ||
# Create a user | ||
RUN addgroup --gid 1137 --system babylon && adduser --uid 1137 --gid 1137 --system --home /home/babylon babylon | ||
|
||
RUN apt-get update && apt-get install -y curl wget bash jq | ||
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 | ||
# Cosmwasm - Download correct libwasmvm version | ||
COPY --from=build-env /go/src/github.com/babylonlabs-io/babylon/go.mod /tmp | ||
RUN WASMVM_VERSION=$(grep github.com/CosmWasm/wasmvm /tmp/go.mod | cut -d' ' -f2) && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.$(uname -m).so \ | ||
-O /lib/libwasmvm.$(uname -m).so && \ | ||
# verify checksum | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ | ||
sha256sum /lib/libwasmvm.$(uname -m).so | grep $(cat /tmp/checksums.txt | grep libwasmvm.$(uname -m) | cut -d ' ' -f 1) | ||
RUN rm -f /tmp/go.mod | ||
# 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 | ||
RUN chmod g+s /home/babylon | ||
USER babylon | ||
USER babylon |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.