-
Notifications
You must be signed in to change notification settings - Fork 45
/
Dockerfile.static
27 lines (19 loc) · 1.14 KB
/
Dockerfile.static
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
FROM golang:1.22.3-alpine as go-builder
SHELL ["/bin/sh", "-ecuxo", "pipefail"]
RUN apk add --no-cache ca-certificates build-base linux-headers git gmp gmp-dev
WORKDIR /chain
COPY . /chain
RUN go mod download
RUN GO_OWASM_VERSION=$(go list -m github.com/bandprotocol/go-owasm | cut -d ' ' -f 2) && \
wget https://github.com/bandprotocol/go-owasm/releases/download/$GO_OWASM_VERSION/libgo_owasm_muslc.x86_64.a -O /lib/libgo_owasm_muslc.x86_64.a
RUN sha256sum /lib/libgo_owasm_muslc.x86_64.a | grep c56ad7694196175df51585cbc7f2543cfa8ba9a42c62dcfec76ca28a5842d073
# Copy the library you want to the final location that will be found by the linker flag `-lgo_owasm_muslc`
RUN cp /lib/libgo_owasm_muslc.x86_64.a /lib/libgo_owasm_muslc.a
# force it to use static lib (from above) not standard libgo_owasm.so file
RUN LEDGER_ENABLED=true BUILD_TAGS=muslc LINK_STATICALLY=true make install \
&& echo "Ensuring binary is statically linked ..." \
&& (file /go/bin/bandd | grep "statically linked")
# --------------------------------------------------------
FROM alpine:3.16
COPY --from=go-builder /go/bin/bandd /usr/bin/bandd
ENTRYPOINT ["/usr/bin/bandd"]