-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add custom querier to wasm image (#7559)
* add custom querier to wasmd + build for arm64 * Use build-push-action for multi-platform build * fix build-args * fix bad bash * lint * add build-essential for building arm64 arch * add g++-aarch64-linux-gnu for arm64 * add some more info to custom query error msg
- Loading branch information
1 parent
107ab75
commit 2acc7f6
Showing
8 changed files
with
187 additions
and
35 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
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,19 +1,11 @@ | ||
FROM golang:1.22-alpine3.20 as builder | ||
|
||
FROM golang:1.22-alpine3.20 AS builder-base | ||
ARG LIBWASM_VERSION | ||
ARG LIBWASM_CHECKSUM | ||
ARG TARGETARCH | ||
|
||
RUN test -n "${LIBWASM_VERSION}" | ||
RUN test -n "${LIBWASM_CHECKSUM}" | ||
|
||
RUN set -eux; apk add --no-cache git libusb-dev linux-headers gcc musl-dev make; | ||
|
||
ENV GOPATH="" | ||
|
||
# Grab the static library and copy it to location that will be found by the linker flag `-lwasmvm_muslc`. | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a | ||
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ${LIBWASM_CHECKSUM} | ||
RUN cp /lib/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a | ||
RUN set -eux; apk add --no-cache ca-certificates build-base git libusb-dev linux-headers curl; | ||
Check notice Code scanning / SonarCloud Arguments in long RUN instructions should be sorted Low
Sort these package names alphanumerically. See more on SonarQube Cloud
|
||
|
||
# Copy relevant files before go mod download. Replace directives to local paths break if local | ||
# files are not copied before go mod download. | ||
|
@@ -25,14 +17,32 @@ ADD LICENSE LICENSE | |
COPY go.mod . | ||
COPY go.sum . | ||
|
||
RUN go mod download | ||
|
||
|
||
# Since it is not easy to fully cache a RUN script download of libwasmvm, we use two different stages | ||
# and copy the correct file in the final stage. The multistage setup also helps speed up the build process | ||
FROM alpine:3.18 AS amd64-stage | ||
ARG LIBWASM_VERSION | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a | ||
|
||
|
||
FROM alpine:3.18 AS arm64-stage | ||
ARG LIBWASM_VERSION | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a | ||
|
||
# We have this one with nothing else in it, because COPY --from can't use variables (but FROM can) | ||
FROM ${TARGETARCH}-stage AS libwasm-stage | ||
|
||
# Having this is a separate stage allows the previous stages to run in parallel | ||
FROM builder-base AS builder | ||
WORKDIR /go/modules/light-clients/08-wasm | ||
|
||
RUN go mod download | ||
COPY --from=libwasm-stage /lib/libwasmvm_muslc.* /lib/ | ||
|
||
RUN GOOS=linux GOARCH=amd64 go build -mod=readonly -tags "netgo ledger muslc" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=sim -X github.com/cosmos/cosmos-sdk/version.AppName=simd -X github.com/cosmos/cosmos-sdk/version.Version= -X github.com/cosmos/cosmos-sdk/version.Commit= -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger muslc," -w -s -linkmode=external -extldflags "-Wl,-z,muldefs -static"' -trimpath -o /go/build/ ./... | ||
RUN go build -mod=readonly -tags "netgo ledger muslc" -ldflags '-X github.com/cosmos/cosmos-sdk/version.Name=sim -X github.com/cosmos/cosmos-sdk/version.AppName=simd -X github.com/cosmos/cosmos-sdk/version.Version= -X github.com/cosmos/cosmos-sdk/version.Commit= -X "github.com/cosmos/cosmos-sdk/version.BuildTags=netgo ledger muslc," -w -s -linkmode=external -extldflags "-Wl,-z,muldefs -static"' -trimpath -o /go/build/ ./... | ||
|
||
FROM alpine:3.18 | ||
|
||
FROM alpine:3.18 | ||
COPY --from=builder /go/build/simd /bin/simd | ||
|
||
ENTRYPOINT ["simd"] |
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.