mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +00:00
feat: add rocksdb Dockerfile (#1625)
* feat: add rocksdb Dockerfile * update kvtool
This commit is contained in:
parent
49812b6e7c
commit
e4a57113c1
47
Dockerfile-rocksdb
Normal file
47
Dockerfile-rocksdb
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
FROM golang:1.20-bullseye AS kava-builder
|
||||||
|
|
||||||
|
# Set up dependencies
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y git make gcc libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Set working directory for the build
|
||||||
|
WORKDIR /root
|
||||||
|
# default home directory is /root
|
||||||
|
|
||||||
|
# install rocksdb
|
||||||
|
ARG rocksdb_version=v7.10.2
|
||||||
|
ENV ROCKSDB_VERSION=$rocksdb_version
|
||||||
|
|
||||||
|
RUN git clone https://github.com/facebook/rocksdb.git \
|
||||||
|
&& cd rocksdb \
|
||||||
|
&& git checkout $ROCKSDB_VERSION \
|
||||||
|
&& make -j$(nproc) install-shared \
|
||||||
|
&& ldconfig
|
||||||
|
|
||||||
|
# Add source files for kava
|
||||||
|
COPY . kava
|
||||||
|
|
||||||
|
ARG kava_database_backend=rocksdb
|
||||||
|
ENV KAVA_DATABASE_BACKEND=$kava_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 \
|
||||||
|
cd kava && make install COSMOS_BUILD_OPTIONS=$KAVA_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=kava-builder /usr/local/lib/ /usr/local/lib/
|
||||||
|
RUN ldconfig
|
||||||
|
|
||||||
|
# copy kava binary
|
||||||
|
COPY --from=kava-builder /go/bin/kava /bin/kava
|
||||||
|
|
||||||
|
CMD ["kava"]
|
3
Makefile
3
Makefile
@ -242,6 +242,9 @@ format:
|
|||||||
docker-build:
|
docker-build:
|
||||||
DOCKER_BUILDKIT=1 $(DOCKER) build -t kava/kava:local .
|
DOCKER_BUILDKIT=1 $(DOCKER) build -t kava/kava:local .
|
||||||
|
|
||||||
|
docker-build-rocksdb:
|
||||||
|
DOCKER_BUILDKIT=1 $(DOCKER) build -f Dockerfile-rocksdb -t kava/kava:local .
|
||||||
|
|
||||||
build-docker-local-kava:
|
build-docker-local-kava:
|
||||||
@$(MAKE) -C networks/local
|
@$(MAKE) -C networks/local
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user