1
- ARG GO_VERSION="1.20"
2
- ARG OS_VERESION="3.16"
1
+ ARG GO_VERSION="1.20.8"
3
2
ARG BUILDPLATFORM=linux/amd64
4
3
5
4
# ###############################################################################
6
- FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine${OS_VERESION} as base
5
+ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION}-alpine as base
7
6
8
7
# NOTE: add libusb-dev to run with LEDGER_ENABLED=true
9
- RUN set -eux &&\
8
+ RUN set -eu &&\
10
9
apk update &&\
11
10
apk add --no-cache \
12
11
ca-certificates \
13
12
linux-headers \
14
13
build-base \
14
+ gcompat \
15
15
cmake \
16
16
bash \
17
+ curl \
17
18
git
18
19
19
20
COPY ./bin/install-mimalloc ./bin/install-wasmvm /usr/local/bin/
@@ -29,12 +30,12 @@ ARG COSMOS_BUILD_OPTIONS="nostrip"
29
30
ARG GIT_TAG="v2.4.1"
30
31
ARG GIT_REPO="terra-money/core"
31
32
# ARG LDFLAGS="-extldflags '-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static'"
32
- ARG LDFLAGS='-extldflags "-Wl,-z,muldefs -static"'
33
+ ARG LDFLAGS='-linkmode external - extldflags "-Wl,-z,muldefs -static"'
33
34
ARG MIMALLOC_VERSION
34
35
35
36
ENV MIMALLOC_VERSION=${MIMALLOC_VERSION}
36
37
# install mimalloc if version is specified
37
- RUN set -eux && \
38
+ RUN set -eu && \
38
39
if [ -n "${MIMALLOC_VERSION}" ]; then install-mimalloc "${MIMALLOC_VERSION}" ; fi
39
40
40
41
# download dependencies to cache as layer
@@ -43,12 +44,12 @@ WORKDIR ${GOPATH}/src/app
43
44
ENV GIT_TAG=${GIT_TAG} \
44
45
GIT_REPO=${GIT_REPO}
45
46
46
- RUN set -eux && \
47
+ RUN set -eu && \
47
48
git clone -b ${GIT_TAG} https://github.com/${GIT_REPO}.git ./ && \
48
49
go mod download -x
49
50
50
51
# download wasmvm if version is specified
51
- RUN set -ux && \
52
+ RUN set -u && \
52
53
WASMVM_VERSION="$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2)" && \
53
54
[ -n "${WASMVM_VERSION}" ] && install-wasmvm "${WASMVM_VERSION}" || true
54
55
@@ -67,13 +68,13 @@ RUN set -eux && \
67
68
${BUILD_COMMAND}
68
69
69
70
# verify static binary
70
- # RUN set -x && \
71
- # file ${GOPATH}/bin/${BIN_NAME} && \
72
- # echo "Ensuring binary is statically linked ..." && \
73
- # (file ${GOPATH}/bin/${BIN_NAME} | grep "statically linked")
71
+ RUN set -x && \
72
+ file ${GOPATH}/bin/${BIN_NAME} && \
73
+ echo "Ensuring binary is statically linked ..." && \
74
+ (file ${GOPATH}/bin/${BIN_NAME} | grep "statically linked" )
74
75
75
76
# ###############################################################################
76
- FROM --platform=${BUILDPLATFORM} alpine:${OS_VERESION} as prod
77
+ FROM --platform=${BUILDPLATFORM} alpine:3.18 as prod
77
78
78
79
# build args passed down to env var
79
80
0 commit comments