-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
58 lines (45 loc) · 1.91 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
# Use Ubuntu as the base image
FROM ubuntu:latest as go-builder
# Install necessary dependencies
RUN apt-get update && apt-get install -y \
wget make git \
&& rm -rf /var/lib/apt/lists/*
# Download and install Go 1.21
RUN wget https://golang.org/dl/go1.21.4.linux-amd64.tar.gz && \
tar -xvf go1.21.4.linux-amd64.tar.gz && \
mv go /usr/local && \
rm go1.21.4.linux-amd64.tar.gz
# Set Go environment variables
ENV GOROOT=/usr/local/go
ENV GOPATH=$HOME/go
ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH
RUN apt-get update -y
RUN apt-get install build-essential -y
# Set the working directory
WORKDIR /app
# Download go dependencies
COPY go.mod go.sum ./
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 ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.a \
-O /lib/libwasmvm_muslc.a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.x86_64.so \
-O /lib/libwasmvm.x86_64.so && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm.aarch64.so \
-O /lib/libwasmvm.aarch64.so
# Copy the remaining files
COPY . .
RUN make build
FROM ubuntu:latest
RUN apt-get update -y
COPY --from=go-builder /app/build/aib-rollapp /usr/local/bin/aibd
COPY --from=go-builder /lib/libwasmvm.x86_64.so /lib/libwasmvm.x86_64.so
COPY --from=go-builder /lib/libwasmvm.aarch64.so /lib/libwasmvm.aarch64.so
WORKDIR /app
EXPOSE 26657 1317