mirror of
				https://github.com/0glabs/0g-chain.git
				synced 2025-04-04 15:55:23 +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 | RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl | ||||||
| 
 | 
 | ||||||
| # Set working directory for the build | # Set working directory for the build | ||||||
| WORKDIR /root/kava | WORKDIR /root/0g-chain | ||||||
| # default home directory is /root | # default home directory is /root | ||||||
| 
 | 
 | ||||||
| # Copy dependency files first to facilitate dependency caching | # 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 | FROM alpine:3.15 | ||||||
| 
 | 
 | ||||||
| RUN apk add bash jq curl | 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 | RUN apt-get update | ||||||
| 
 | 
 | ||||||
| WORKDIR /root/kava | WORKDIR /root/0gchain | ||||||
| # Copy dependency files first to facilitate dependency caching | # Copy dependency files first to facilitate dependency caching | ||||||
| COPY ./go.mod ./ | COPY ./go.mod ./ | ||||||
| COPY ./go.sum ./ | COPY ./go.sum ./ | ||||||
| @ -15,13 +15,13 @@ RUN --mount=type=cache,target=/root/.cache/go-build \ | |||||||
| # Add source files | # Add source files | ||||||
| COPY . . | COPY . . | ||||||
| 
 | 
 | ||||||
| ARG kava_database_backend=rocksdb | ARG 0gchain_database_backend=rocksdb | ||||||
| ENV KAVA_DATABASE_BACKEND=$kava_database_backend | ENV 0GCHAIN_DATABASE_BACKEND=$0gchain_database_backend | ||||||
| 
 | 
 | ||||||
| # Mount go build and mod caches as container caches, persisted between builder invocations | # Mount go build and mod caches as container caches, persisted between builder invocations | ||||||
| RUN --mount=type=cache,target=/root/.cache/go-build \ | RUN --mount=type=cache,target=/root/.cache/go-build \ | ||||||
|     --mount=type=cache,target=/go/pkg/mod \ |     --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 | FROM ubuntu:22.04 | ||||||
| @ -31,10 +31,10 @@ RUN apt-get update \ | |||||||
|     && rm -rf /var/lib/apt/lists/* |     && rm -rf /var/lib/apt/lists/* | ||||||
| 
 | 
 | ||||||
| # copy rocksdb shared objects | # 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 | RUN ldconfig | ||||||
| 
 | 
 | ||||||
| # copy kava binary | # copy 0g-chain binary | ||||||
| COPY --from=kava-builder /go/bin/kava /bin/kava | COPY --from=chain-builder /go/bin/0gchaind /bin/0gchaind | ||||||
| 
 | 
 | ||||||
| CMD ["kava"] | CMD ["0gchaind"] | ||||||
|  | |||||||
							
								
								
									
										35
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								Makefile
									
									
									
									
									
								
							| @ -1,8 +1,10 @@ | |||||||
| ################################################################################
 | ################################################################################
 | ||||||
| ###                             Project Info                                 ###
 | ###                             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 | GO_BIN ?= go | ||||||
| 
 | 
 | ||||||
| GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||||||
| @ -37,7 +39,7 @@ print-git-info: | |||||||
| 
 | 
 | ||||||
| .PHONY: print-version | .PHONY: print-version | ||||||
| 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                             ###
 | ###                             Project Settings                             ###
 | ||||||
| @ -144,8 +146,8 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) | |||||||
| 
 | 
 | ||||||
| # process linker flags
 | # process linker flags
 | ||||||
| 
 | 
 | ||||||
| ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=kava \
 | ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=$(PROJECT_NAME) \
 | ||||||
| 		  -X github.com/cosmos/cosmos-sdk/version.AppName=kava \
 | 		  -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.Version=$(VERSION_NUMBER) \
 | ||||||
| 		  -X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_COMMIT) \
 | 		  -X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_COMMIT) \
 | ||||||
| 		  -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
 | 		  -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" \
 | ||||||
| @ -190,9 +192,9 @@ all: install | |||||||
| 
 | 
 | ||||||
| build: go.sum | build: go.sum | ||||||
| ifeq ($(OS), Windows_NT) | 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 | 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 | endif | ||||||
| 
 | 
 | ||||||
| build-linux: go.sum | 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 | 	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 | install: go.sum | ||||||
| 	$(GO_BIN) install -mod=readonly $(BUILD_FLAGS) ./cmd/kava | 	$(GO_BIN) install -mod=readonly $(BUILD_FLAGS) $(MAIN_ENTRY) | ||||||
| 
 | 
 | ||||||
| ########################################
 | ########################################
 | ||||||
| ### Tools & dependencies
 | ### Tools & dependencies
 | ||||||
| @ -229,6 +231,7 @@ go.sum: go.mod | |||||||
| # Set to exclude riot links as they trigger false positives
 | # Set to exclude riot links as they trigger false positives
 | ||||||
| link-check: | link-check: | ||||||
| 	@$(GO_BIN) get -u github.com/raviqqe/liche@f57a5d1c5be4856454cb26de155a65a4fd856ee3 | 	@$(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*" | 	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: | format: | ||||||
| @ -243,14 +246,14 @@ format: | |||||||
| ###                                Localnet                                 ###
 | ###                                Localnet                                 ###
 | ||||||
| ###############################################################################
 | ###############################################################################
 | ||||||
| 
 | 
 | ||||||
| # Build docker image and tag as kava/kava:local
 | # Build docker image and tag as 0glabs/0g-chain:local
 | ||||||
| docker-build: | 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-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 | 	@$(MAKE) -C networks/local | ||||||
| 
 | 
 | ||||||
| # Run a 4-node testnet locally
 | # Run a 4-node testnet locally
 | ||||||
| @ -264,7 +267,7 @@ localnet-stop: | |||||||
| # Launch a new single validator chain
 | # Launch a new single validator chain
 | ||||||
| start: | start: | ||||||
| 	./contrib/devnet/init-new-chain.sh | 	./contrib/devnet/init-new-chain.sh | ||||||
| 	kava start | 	$(BINARY_NAME) start | ||||||
| 
 | 
 | ||||||
| #proto-format:
 | #proto-format:
 | ||||||
| #@echo "Formatting Protobuf files"
 | #@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
 | # 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: | start-remote-sims: | ||||||
| 	# build the image used for running sims in, and tag it | 	# 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 | 	# 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 | 	# submit an array job on AWS Batch, using 1000 seeds, spot instances | ||||||
| 	aws batch submit-job \
 | 	aws batch submit-job \
 | ||||||
| 		-—job-name "master-$(VERSION)" \
 | 		-—job-name "master-$(VERSION)" \
 | ||||||
| 		-—job-queue "simulation-1-queue-spot" \
 | 		-—job-queue "simulation-1-queue-spot" \
 | ||||||
| 		-—array-properties size=1000 \
 | 		-—array-properties size=1000 \
 | ||||||
| 		-—job-definition kava-sim-master \
 | 		-—job-definition $(BINARY_NAME)-sim-master \
 | ||||||
| 		-—container-override environment=[{SIM_NAME=master-$(VERSION)}] | 		-—container-override environment=[{SIM_NAME=master-$(VERSION)}] | ||||||
| 
 | 
 | ||||||
| update-kvtool: | update-kvtool: | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ version: '3' | |||||||
| services: | services: | ||||||
|   kvdnode0: |   kvdnode0: | ||||||
|     container_name: kvdnode0 |     container_name: kvdnode0 | ||||||
|     image: "kava/kavanode" |     image: "0glabs/0g-chain-node" | ||||||
|     ports: |     ports: | ||||||
|       - "26656-26657:26656-26657" |       - "26656-26657:26656-26657" | ||||||
|     environment: |     environment: | ||||||
| @ -17,7 +17,7 @@ services: | |||||||
| 
 | 
 | ||||||
|   kvdnode1: |   kvdnode1: | ||||||
|     container_name: kvdnode1 |     container_name: kvdnode1 | ||||||
|     image: "kava/kavanode" |     image: "0glabs/0g-chain-node" | ||||||
|     ports: |     ports: | ||||||
|       - "26659-26660:26656-26657" |       - "26659-26660:26656-26657" | ||||||
|     environment: |     environment: | ||||||
| @ -31,7 +31,7 @@ services: | |||||||
| 
 | 
 | ||||||
|   kvdnode2: |   kvdnode2: | ||||||
|     container_name: kvdnode2 |     container_name: kvdnode2 | ||||||
|     image: "kava/kavanode" |     image: "0glabs/0g-chain-node" | ||||||
|     environment: |     environment: | ||||||
|       - ID=2 |       - ID=2 | ||||||
|       - LOG=${LOG:-kvd.log} |       - LOG=${LOG:-kvd.log} | ||||||
| @ -45,7 +45,7 @@ services: | |||||||
| 
 | 
 | ||||||
|   kvdnode3: |   kvdnode3: | ||||||
|     container_name: kvdnode3 |     container_name: kvdnode3 | ||||||
|     image: "kava/kavanode" |     image: "0glabs/0g-chain-node" | ||||||
|     environment: |     environment: | ||||||
|       - ID=3 |       - ID=3 | ||||||
|       - LOG=${LOG:-kvd.log} |       - LOG=${LOG:-kvd.log} | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Solovyov1796
						Solovyov1796