forked from Kava-Labs/kava
-
Notifications
You must be signed in to change notification settings - Fork 42
/
Dockerfile-rocksdb
40 lines (28 loc) · 1.05 KB
/
Dockerfile-rocksdb
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
FROM kava/rocksdb:v8.10.1-go1.21 AS kava-builder
RUN apt-get update
WORKDIR /root/0gchain
# Copy dependency files first to facilitate dependency caching
COPY ./go.mod ./
COPY ./go.sum ./
# Download dependencies
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go version && go mod download
# Add source files
COPY . .
ARG 0gchain_database_backend=rocksdb
ENV 0GCHAIN_DATABASE_BACKEND=$0gchain_database_backend
# Mount go build and mod caches as container caches, persisted between builder invocations
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
make install COSMOS_BUILD_OPTIONS=$0GCHAIN_DATABASE_BACKEND
FROM ubuntu:22.04
RUN apt-get update \
&& apt-get install -y libsnappy1v5 libgflags2.2 zlib1g libbz2-1.0 curl jq \
&& rm -rf /var/lib/apt/lists/*
# copy rocksdb shared objects
COPY --from=chain-builder /usr/local/lib/ /usr/local/lib/
RUN ldconfig
# copy 0g-chain binary
COPY --from=chain-builder /go/bin/0gchaind /bin/0gchaind
CMD ["0gchaind"]