-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc1694b
commit 8761e98
Showing
2 changed files
with
94 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
ARG GO_VERSION="1.20.0" | ||
ARG RUNNER_IMAGE="gcr.io/distroless/static" | ||
|
||
# -------------------------------------------------------- | ||
# Builder | ||
# -------------------------------------------------------- | ||
|
||
FROM golang:${GO_VERSION}-alpine as builder | ||
|
||
ARG GIT_VERSION | ||
ARG GIT_COMMIT | ||
ARG BUILD_TAGS | ||
ARG ENABLED_PROPOSALS | ||
|
||
RUN apk add --no-cache \ | ||
ca-certificates \ | ||
build-base \ | ||
linux-headers | ||
|
||
# Download go dependencies | ||
WORKDIR /neutron | ||
COPY go.mod go.sum ./ | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/root/go/pkg/mod \ | ||
go mod download | ||
|
||
# Cosmwasm - Download correct libwasmvm version | ||
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \ | ||
-O /lib/libwasmvm_muslc.a && \ | ||
# verify checksum | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ | ||
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1) | ||
|
||
# Copy the remaining files | ||
COPY . . | ||
|
||
# Build neutrond binary | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/root/go/pkg/mod \ | ||
go build \ | ||
-mod=readonly \ | ||
-tags "netgo,ledger,muslc" \ | ||
-ldflags "-X github.com/cosmos/cosmos-sdk/version.Name="neutron" \ | ||
-X github.com/cosmos/cosmos-sdk/version.AppName="neutrond" \ | ||
-X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION} \ | ||
-X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \ | ||
-X github.com/cosmos/cosmos-sdk/version.BuildTags='${BUILD_TAGS}' \ | ||
-X github.com/neutron-org/neutron/app.EnableSpecificProposals=${ENABLED_PROPOSALS} \ | ||
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ | ||
-trimpath \ | ||
-o /neutron/build/neutrond \ | ||
/neutron/cmd/neutrond | ||
|
||
# -------------------------------------------------------- | ||
# Runner | ||
# -------------------------------------------------------- | ||
|
||
FROM ${RUNNER_IMAGE} | ||
|
||
COPY --from=builder /neutron/build/neutrond /bin/neutrond | ||
|
||
ENV HOME /neutron | ||
WORKDIR $HOME | ||
|
||
EXPOSE 26656 | ||
EXPOSE 26657 | ||
EXPOSE 1317 | ||
|
||
ENTRYPOINT ["neutrond"] |
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