forked from osmosis-labs/osmosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (51 loc) · 2.17 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
# syntax=docker/dockerfile:1
ARG GO_VERSION="1.18"
ARG RUNNER_IMAGE="gcr.io/distroless/static"
# --------------------------------------------------------
# Builder
# --------------------------------------------------------
FROM golang:${GO_VERSION}-alpine as builder
RUN set -eux; apk add --no-cache ca-certificates build-base; apk add git linux-headers
# Download go dependencies
WORKDIR /osmosis
COPY go.* .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download
# Cosmwasm - download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.a
# Cosmwasm - verify checksum
RUN wget https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep $(uname -m) | cut -d ' ' -f 1)
# Copy the remaining files
COPY . .
# Build osmosisd binary
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
VERSION=$(echo $(git describe --tags) | sed 's/^v//') && \
COMMIT=$(git log -1 --format='%H') && \
go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags "-X github.com/cosmos/cosmos-sdk/version.Name="osmosis" \
-X github.com/cosmos/cosmos-sdk/version.AppName="osmosisd" \
-X github.com/cosmos/cosmos-sdk/version.Version=$VERSION \
-X github.com/cosmos/cosmos-sdk/version.Commit=$COMMIT \
-X github.com/cosmos/cosmos-sdk/version.BuildTags='netgo,ledger,muslc' \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o /osmosis/build/ \
./...
# --------------------------------------------------------
# Runner
# --------------------------------------------------------
FROM ${RUNNER_IMAGE}
COPY --from=builder /osmosis/build/osmosisd /bin/osmosisd
ENV HOME /osmosis
WORKDIR $HOME
EXPOSE 26656
EXPOSE 26657
EXPOSE 1317
ENTRYPOINT ["osmosisd"]