mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-11-20 15:05:21 +00:00
update build file
This commit is contained in:
parent
8bc3b15c46
commit
d61f4e94fd
@ -7,7 +7,7 @@ FROM golang:1.21-alpine AS build-env
|
||||
RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl
|
||||
|
||||
# Set working directory for the build
|
||||
WORKDIR /root/kava
|
||||
WORKDIR /root/0g-chain
|
||||
# default home directory is /root
|
||||
|
||||
# Copy dependency files first to facilitate dependency caching
|
||||
@ -32,6 +32,6 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
FROM alpine:3.15
|
||||
|
||||
RUN apk add bash jq curl
|
||||
COPY --from=build-env /go/bin/kava /bin/kava
|
||||
COPY --from=build-env /go/bin/0gchaind /bin/0gchaind
|
||||
|
||||
CMD ["kava"]
|
||||
CMD ["0gchaind"]
|
||||
|
@ -2,7 +2,7 @@ FROM kava/rocksdb:v8.10.1-go1.21 AS kava-builder
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
WORKDIR /root/kava
|
||||
WORKDIR /root/0gchain
|
||||
# Copy dependency files first to facilitate dependency caching
|
||||
COPY ./go.mod ./
|
||||
COPY ./go.sum ./
|
||||
@ -15,13 +15,13 @@ RUN --mount=type=cache,target=/root/.cache/go-build \
|
||||
# Add source files
|
||||
COPY . .
|
||||
|
||||
ARG kava_database_backend=rocksdb
|
||||
ENV KAVA_DATABASE_BACKEND=$kava_database_backend
|
||||
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=$KAVA_DATABASE_BACKEND
|
||||
make install COSMOS_BUILD_OPTIONS=$0GCHAIN_DATABASE_BACKEND
|
||||
|
||||
|
||||
FROM ubuntu:22.04
|
||||
@ -31,10 +31,10 @@ RUN apt-get update \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# copy rocksdb shared objects
|
||||
COPY --from=kava-builder /usr/local/lib/ /usr/local/lib/
|
||||
COPY --from=chain-builder /usr/local/lib/ /usr/local/lib/
|
||||
RUN ldconfig
|
||||
|
||||
# copy kava binary
|
||||
COPY --from=kava-builder /go/bin/kava /bin/kava
|
||||
# copy 0g-chain binary
|
||||
COPY --from=chain-builder /go/bin/0gchaind /bin/0gchaind
|
||||
|
||||
CMD ["kava"]
|
||||
CMD ["0gchaind"]
|
||||
|
35
Makefile
35
Makefile
@ -1,8 +1,10 @@
|
||||
################################################################################
|
||||
### Project Info ###
|
||||
################################################################################
|
||||
PROJECT_NAME := kava# unique namespace for project
|
||||
|
||||
PROJECT_NAME := 0g-chain# unique namespace for project
|
||||
BINARY_NAME := 0gchaind
|
||||
MAIN_ENTRY := ./cmd/$(BINARY_NAME)
|
||||
DOCKER_IMAGE_NAME := 0glabs/$(PROJECT_NAME)
|
||||
GO_BIN ?= go
|
||||
|
||||
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
|
||||
@ -37,7 +39,7 @@ print-git-info:
|
||||
|
||||
.PHONY: print-version
|
||||
print-version:
|
||||
@echo "kava $(VERSION)\ntendermint $(TENDERMINT_VERSION)\ncosmos $(COSMOS_SDK_VERSION)"
|
||||
@echo "$(BINARY_NAME) $(VERSION)\ntendermint $(TENDERMINT_VERSION)\ncosmos $(COSMOS_SDK_VERSION)"
|
||||
|
||||
################################################################################
|
||||
### Project Settings ###
|
||||
@ -144,8 +146,8 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))
|
||||
|
||||
# process linker flags
|
||||
|
||||
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=kava \
|
||||
-X github.com/cosmos/cosmos-sdk/version.AppName=kava \
|
||||
ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(PROJECT_NAME) \
|
||||
-X github.com/cosmos/cosmos-sdk/version.AppName=$(PROJECT_NAME) \
|
||||
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION_NUMBER) \
|
||||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_COMMIT) \
|
||||
-X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
|
||||
@ -190,9 +192,9 @@ all: install
|
||||
|
||||
build: go.sum
|
||||
ifeq ($(OS), Windows_NT)
|
||||
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/kava.exe ./cmd/kava
|
||||
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME).exe $(MAIN_ENTRY)
|
||||
else
|
||||
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/kava ./cmd/kava
|
||||
$(GO_BIN) build -mod=readonly $(BUILD_FLAGS) -o out/$(shell $(GO_BIN) env GOOS)/$(BINARY_NAME) $(MAIN_ENTRY)
|
||||
endif
|
||||
|
||||
build-linux: go.sum
|
||||
@ -207,7 +209,7 @@ build-rocksdb-brew:
|
||||
export CGO_LDFLAGS := -L$(shell brew --prefix rocksdb)/lib -lrocksdb -lstdc++ -lm -lz -L$(shell brew --prefix snappy)/lib -L$(shell brew --prefix lz4)/lib -L$(shell brew --prefix zstd)/lib
|
||||
|
||||
install: go.sum
|
||||
$(GO_BIN) install -mod=readonly $(BUILD_FLAGS) ./cmd/kava
|
||||
$(GO_BIN) install -mod=readonly $(BUILD_FLAGS) $(MAIN_ENTRY)
|
||||
|
||||
########################################
|
||||
### Tools & dependencies
|
||||
@ -229,6 +231,7 @@ go.sum: go.mod
|
||||
# Set to exclude riot links as they trigger false positives
|
||||
link-check:
|
||||
@$(GO_BIN) get -u github.com/raviqqe/liche@f57a5d1c5be4856454cb26de155a65a4fd856ee3
|
||||
# TODO: replace kava in following line with project name
|
||||
liche -r . --exclude "^http://127.*|^https://riot.im/app*|^http://kava-testnet*|^https://testnet-dex*|^https://kava3.data.kava.io*|^https://ipfs.io*|^https://apps.apple.com*|^https://kava.quicksync.io*"
|
||||
|
||||
format:
|
||||
@ -243,14 +246,14 @@ format:
|
||||
### Localnet ###
|
||||
###############################################################################
|
||||
|
||||
# Build docker image and tag as kava/kava:local
|
||||
# Build docker image and tag as 0glabs/0g-chain:local
|
||||
docker-build:
|
||||
DOCKER_BUILDKIT=1 $(DOCKER) build -t kava/kava:local .
|
||||
DOCKER_BUILDKIT=1 $(DOCKER) build -t $(DOCKER_IMAGE_NAME):local .
|
||||
|
||||
docker-build-rocksdb:
|
||||
DOCKER_BUILDKIT=1 $(DOCKER) build -f Dockerfile-rocksdb -t kava/kava:local .
|
||||
DOCKER_BUILDKIT=1 $(DOCKER) build -f Dockerfile-rocksdb -t $(DOCKER_IMAGE_NAME):local .
|
||||
|
||||
build-docker-local-kava:
|
||||
build-docker-local-0gchain:
|
||||
@$(MAKE) -C networks/local
|
||||
|
||||
# Run a 4-node testnet locally
|
||||
@ -264,7 +267,7 @@ localnet-stop:
|
||||
# Launch a new single validator chain
|
||||
start:
|
||||
./contrib/devnet/init-new-chain.sh
|
||||
kava start
|
||||
$(BINARY_NAME) start
|
||||
|
||||
#proto-format:
|
||||
#@echo "Formatting Protobuf files"
|
||||
@ -335,15 +338,15 @@ test-fuzz:
|
||||
# This submits an AWS Batch job to run a lot of sims, each within a docker image. Results are uploaded to S3
|
||||
start-remote-sims:
|
||||
# build the image used for running sims in, and tag it
|
||||
docker build -f simulations/Dockerfile -t kava/kava-sim:master .
|
||||
docker build -f simulations/Dockerfile -t $(DOCKER_IMAGE_NAME)-sim:master .
|
||||
# push that image to the hub
|
||||
docker push kava/kava-sim:master
|
||||
docker push $(DOCKER_IMAGE_NAME)-sim:master
|
||||
# submit an array job on AWS Batch, using 1000 seeds, spot instances
|
||||
aws batch submit-job \
|
||||
-—job-name "master-$(VERSION)" \
|
||||
-—job-queue "simulation-1-queue-spot" \
|
||||
-—array-properties size=1000 \
|
||||
-—job-definition kava-sim-master \
|
||||
-—job-definition $(BINARY_NAME)-sim-master \
|
||||
-—container-override environment=[{SIM_NAME=master-$(VERSION)}]
|
||||
|
||||
update-kvtool:
|
||||
|
@ -3,7 +3,7 @@ version: '3'
|
||||
services:
|
||||
kvdnode0:
|
||||
container_name: kvdnode0
|
||||
image: "kava/kavanode"
|
||||
image: "0glabs/0g-chain-node"
|
||||
ports:
|
||||
- "26656-26657:26656-26657"
|
||||
environment:
|
||||
@ -17,7 +17,7 @@ services:
|
||||
|
||||
kvdnode1:
|
||||
container_name: kvdnode1
|
||||
image: "kava/kavanode"
|
||||
image: "0glabs/0g-chain-node"
|
||||
ports:
|
||||
- "26659-26660:26656-26657"
|
||||
environment:
|
||||
@ -31,7 +31,7 @@ services:
|
||||
|
||||
kvdnode2:
|
||||
container_name: kvdnode2
|
||||
image: "kava/kavanode"
|
||||
image: "0glabs/0g-chain-node"
|
||||
environment:
|
||||
- ID=2
|
||||
- LOG=${LOG:-kvd.log}
|
||||
@ -45,7 +45,7 @@ services:
|
||||
|
||||
kvdnode3:
|
||||
container_name: kvdnode3
|
||||
image: "kava/kavanode"
|
||||
image: "0glabs/0g-chain-node"
|
||||
environment:
|
||||
- ID=3
|
||||
- LOG=${LOG:-kvd.log}
|
||||
|
Loading…
Reference in New Issue
Block a user