diff --git a/Dockerfile b/Dockerfile index 087d001ee9e..33d7b2c1ffc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,16 @@ -FROM golang:1.20 as builder - +FROM golang:1.20-alpine3.18 as builder ARG IBC_GO_VERSION +RUN set -eux; apk add --no-cache git libusb-dev linux-headers gcc musl-dev make; + ENV GOPATH="" ENV GOMODULE="on" # ensure the ibc go version is being specified for this image. RUN test -n "${IBC_GO_VERSION}" -COPY go.mod . -COPY go.sum . - -RUN go mod download - +# Copy relevant files before go mod download. Replace directives to local paths break if local +# files are not copied before go mod download. ADD internal internal ADD testing testing ADD modules modules @@ -21,11 +19,14 @@ ADD LICENSE LICENSE COPY contrib/devtools/Makefile contrib/devtools/Makefile COPY Makefile . +COPY go.mod . +COPY go.sum . -RUN make build +RUN go mod download -FROM ubuntu:22.04 +RUN BUILD_TAGS=muslc make build +FROM alpine:3.18 ARG IBC_GO_VERSION LABEL "org.cosmos.ibc-go" "${IBC_GO_VERSION}" @@ -33,3 +34,4 @@ LABEL "org.cosmos.ibc-go" "${IBC_GO_VERSION}" COPY --from=builder /go/build/simd /bin/simd ENTRYPOINT ["simd"] +