-
Notifications
You must be signed in to change notification settings - Fork 42
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
chore: bump wasmd and re-enable static linking #213
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
73ce1cf
init
SebastianElvis 42c36f8
changelog and e2e
SebastianElvis 844ae75
try
SebastianElvis c47b9c5
fix
SebastianElvis 7e56281
try
SebastianElvis 12f11ac
try
SebastianElvis d151efa
minor
SebastianElvis 517a396
fix
SebastianElvis 99ed85a
minor
SebastianElvis 1aa3195
fix
SebastianElvis 5dd4db9
minor
SebastianElvis fe977c6
fix
SebastianElvis 25c2c75
cleanup
SebastianElvis 8d5f5a8
try fix gh action warn
SebastianElvis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||
|
||
Comment on lines
+58
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: remove commented code. |
||
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTE: this line addresses the warning of GH action on Dockerfiles