diff --git a/Dockerfile b/Dockerfile index 6fc8f963..a37d1d8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21-alpine AS build-env +FROM --platform=$BUILDPLATFORM golang:1.21-alpine AS build-env # Install minimum necessary dependencies ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev @@ -19,14 +19,17 @@ COPY . . # https://www.docker.com/blog/faster-multi-platform-builds-dockerfile-cross-compilation-guide ARG TARGETOS TARGETARCH - -RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build - +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build-arm; \ + else \ + RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make build; \ + fi FROM alpine:3 RUN apk add --no-cache curl make bash jq sed -COPY --from=build-env /go/src/github.com/cosmos/cosmos-sdk/build/seda-chaid /usr/bin/seda-chaind + +COPY --from=build-env /go/src/github.com/cosmos/cosmos-sdk/build/seda-chaid* /usr/bin/seda-chaind EXPOSE 26656 26657 1317 9090 diff --git a/Makefile b/Makefile index ced4c52d..71aecb49 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,9 @@ all: tools build lint test build: go.sum CGO_ENABLED=1 go build -mod=readonly $(BUILD_FLAGS) -o build/seda-chaind ./cmd/seda-chaind +build-arm: go.sum + CGO_ENABLED=1 go build -mod=readonly $(BUILD_FLAGS) -o build/seda-chaind-arm ./cmd/seda-chaind + build-linux: go.sum LEDGER_ENABLED=false GOOS=linux CGO_ENABLED=1 go build -mod=readonly $(BUILD_FLAGS) -o build/seda-chaind-linux ./cmd/seda-chaind