forked from terra-money/mantlemint
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
73 lines (62 loc) · 2.1 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# docker build . -t cosmwasm/wasmd:latest
# docker run --rm -it cosmwasm/wasmd:latest /bin/sh
FROM golang:1.20-alpine3.18 AS go-builder
ARG BUILDPLATFORM=linux/amd64
# NOTE: add libusb-dev to run with LEDGER_ENABLED=true
RUN set -eux &&\
apk update &&\
apk add --no-cache \
ca-certificates \
linux-headers \
build-base \
cmake \
git
# use mimalloc for musl
WORKDIR ${GOPATH}/src/mimalloc
RUN set -eux &&\
git clone --depth 1 \
https://github.com/microsoft/mimalloc . &&\
mkdir -p build &&\
cd build &&\
cmake .. &&\
make -j$(nproc) &&\
make install
WORKDIR /code
COPY . /code/
# Cosmwasm - Download correct libwasmvm version and verify checksum
RUN set -eux &&\
WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 5) && \
WASMVM_DOWNLOADS="github.com/classic-terra/wasmvm/releases/download/${WASMVM_VERSION}"; \
wget ${WASMVM_DOWNLOADS}/checksums.txt -O /tmp/checksums.txt; \
if [ ${BUILDPLATFORM} = "linux/amd64" ]; then \
WASMVM_URL="${WASMVM_DOWNLOADS}/libwasmvm_muslc.x86_64.a"; \
elif [ ${BUILDPLATFORM} = "linux/arm64" ]; then \
WASMVM_URL="${WASMVM_DOWNLOADS}/libwasmvm_muslc.aarch64.a"; \
else \
echo "Unsupported Build Platfrom ${BUILDPLATFORM}"; \
exit 1; \
fi; \
wget ${WASMVM_URL} -O /lib/libwasmvm_muslc.a; \
CHECKSUM=`sha256sum /lib/libwasmvm_muslc.a | cut -d" " -f1`; \
grep ${CHECKSUM} /tmp/checksums.txt; \
rm /tmp/checksums.txt
# force it to use static lib (from above) not standard libgo_cosmwasm.so file
RUN LEDGER_ENABLED=false \
go build \
-mod=readonly \
-tags "muslc,linux" \
-ldflags " \
-w -s -linkmode=external -extldflags \
'-L/go/src/mimalloc/build -lmimalloc -Wl,-z,muldefs -static' \
" \
-trimpath \
-o build/mantlemint ./sync.go
FROM alpine:3.18
RUN apk update && apk add wget lz4 aria2 curl jq gawk coreutils "zlib>1.2.12-r2" "libssl1.1>1.1.1q-r0"
WORKDIR /root
COPY --from=go-builder /code/build/mantlemint /usr/local/bin/mantlemint
# rest server
EXPOSE 1317
# grpc
EXPOSE 9090
CMD ["/usr/local/bin/mantlemint"]