-
Notifications
You must be signed in to change notification settings - Fork 11
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
9c4fe18
commit e76a59b
Showing
3 changed files
with
88 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# syntax=docker/dockerfile:1 | ||
ARG GO_VERSION="1.20" | ||
ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11" | ||
|
||
# -------------------------------------------------------- | ||
# Builder | ||
# -------------------------------------------------------- | ||
|
||
FROM golang:${GO_VERSION}-alpine as builder | ||
|
||
ARG GIT_VERSION | ||
ARG GIT_COMMIT | ||
|
||
RUN apk add --no-cache \ | ||
ca-certificates \ | ||
build-base \ | ||
linux-headers | ||
|
||
# Download go dependencies | ||
WORKDIR /seda-chain | ||
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 ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') && \ | ||
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.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.$ARCH | cut -d ' ' -f 1) | ||
|
||
# Copy the remaining files | ||
COPY . . | ||
|
||
# Build seda-chiand binary | ||
RUN --mount=type=cache,target=/root/.cache/go-build \ | ||
--mount=type=cache,target=/root/go/pkg/mod \ | ||
GOWORK=off go build -v \ | ||
-mod=readonly \ | ||
-tags "netgo,ledger,muslc" \ | ||
-ldflags \ | ||
"-X github.com/cosmos/cosmos-sdk/version.Name="seda-chain" \ | ||
-X github.com/cosmos/cosmos-sdk/version.AppName="seda-chaind" \ | ||
-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=netgo,ledger,muslc \ | ||
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \ | ||
-trimpath \ | ||
-o /seda-chain/build/seda-chaind \ | ||
cmd/seda-chaind/main.go | ||
# --------- To include chmod and shell for static image | ||
FROM busybox:1.35.0-uclibc as busybox | ||
# -------------------------------------------------------- | ||
# Runner | ||
# -------------------------------------------------------- | ||
FROM ${RUNNER_IMAGE} | ||
|
||
COPY --from=busybox ["/bin/sh", "/bin/chmod", "/bin/chown", "/bin/mkdir", "/bin/"] | ||
RUN mkdir -p /seda-chain/.seda-chain && chown nonroot:nonroot -R /seda-chain/.seda-chain | ||
|
||
USER nonroot | ||
COPY --from=builder --chown=nonroot:nonroot /seda-chain/build/seda-chaind /bin/seda-chaind | ||
|
||
ENV HOME /seda-chain | ||
WORKDIR $HOME | ||
|
||
EXPOSE 26656 | ||
EXPOSE 26657 | ||
EXPOSE 1317 | ||
EXPOSE 9090 | ||
|
||
COPY --chown=nonroot:nonroot scripts/validator_setup/validator_setup.sh . | ||
RUN chmod +x validator_setup.sh | ||
ENTRYPOINT ["sh", "validator_setup.sh"] |
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