forked from oraichain/orai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.prod
executable file
·54 lines (40 loc) · 1.82 KB
/
Dockerfile.prod
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
FROM golang:1.18-alpine as builder
# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
# with some changes to support our toolchain, etc
RUN set -eux; apk add --no-cache ca-certificates build-base;
RUN apk add upx
# NOTE: add these to run with LEDGER_ENABLED=true
# RUN apk add libusb-dev linux-headers
WORKDIR /workspace
COPY app/ /workspace/app
COPY cmd/ /workspace/cmd
COPY packages/ /workspace/packages
COPY doc/statik /workspace/doc/statik
COPY go.mod /workspace/
COPY go.sum /workspace/
COPY Makefile /workspace/
COPY oraivisor/ /workspace/oraivisor
# See https://github.com/Oraichain/wasmvm/releases (tag v1.2.0)
RUN wget -O /lib/libwasmvm_muslc.a https://github.com/oraichain/wasmvm/releases/download/v1.2.0/libwasmvm_muslc.a
# RUN go mod tidy && go get ./...
# # force it to use static lib (from above) not standard libgo_cosmwasm.so file
RUN make build LEDGER_ENABLED=false BUILD_TAGS=muslc GOMOD_FLAGS= VERSION=0.41.2
RUN upx --best --lzma /workspace/build/oraid
# install oraivisor
RUN cd oraivisor && make build
RUN upx --best --lzma /workspace/oraivisor/build/oraivisor
# # then remove
# RUN rm -rf /workspace/*
FROM alpine:3.16
WORKDIR /workspace
RUN apk update
# need to install build-base to run go oraid binary
RUN apk add bash build-base jq
ENV DAEMON_ALLOW_DOWNLOAD_BINARIES=true DAEMON_RESTART_AFTER_UPGRADE=true DAEMON_NAME=oraid DAEMON_HOME=/root
ENV PATH="${DAEMON_HOME}/oraivisor/current/bin:${PATH}"
RUN mkdir -p $DAEMON_HOME/oraivisor/genesis/bin
# init first symbolic link to run oraid and later oraivisor will update the link
RUN ln -s $DAEMON_HOME/oraivisor/genesis $DAEMON_HOME/oraivisor/current
COPY --from=builder /workspace/oraivisor/build/oraivisor /usr/bin
COPY --from=builder /workspace/build/oraid $DAEMON_HOME/oraivisor/genesis/bin