-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update dockerfile and scripts to switch all to cli based engine
- Loading branch information
1 parent
901615d
commit 4760af0
Showing
15 changed files
with
247 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ Dockerfile | |
|
||
# build | ||
/bin | ||
!/bin/engine | ||
|
||
# repo files | ||
README.md | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
# base Go image version. | ||
FROM golang:1.13.0-stretch AS build | ||
|
||
WORKDIR /project | ||
# base Go image version for building the binaries | ||
FROM golang:1.13.10 AS build | ||
WORKDIR /app | ||
|
||
# install dependencies | ||
COPY go.mod go.sum ./ | ||
RUN go mod download | ||
|
||
COPY . . | ||
ARG version | ||
RUN go build -mod=readonly -o ./bin/engine -ldflags="-X 'github.com/mesg-foundation/engine/version.Version=$version'" core/main.go | ||
|
||
RUN go build -mod=readonly -o ./bin/mesg-cli -ldflags="-s -w -X 'github.com/cosmos/cosmos-sdk/version.Name=mesg' -X 'github.com/cosmos/cosmos-sdk/version.ServerName=mesg-daemon' -X 'github.com/cosmos/cosmos-sdk/version.ClientName=mesg-cli' -X 'github.com/cosmos/cosmos-sdk/version.Version=$version'" ./cmd/mesg-cli/ | ||
RUN go build -mod=readonly -o ./bin/mesg-daemon -ldflags="-s -w -X 'github.com/cosmos/cosmos-sdk/version.Name=mesg' -X 'github.com/cosmos/cosmos-sdk/version.ServerName=mesg-daemon' -X 'github.com/cosmos/cosmos-sdk/version.ClientName=mesg-cli' -X 'github.com/cosmos/cosmos-sdk/version.Version=$version'" ./cmd/mesg-daemon/ | ||
|
||
# ubuntu image with binaries for distribution | ||
FROM ubuntu:18.04 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends ca-certificates=20180409 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
apt-get install -y --no-install-recommends ca-certificates=20180409 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /app | ||
COPY --from=build /project/bin/engine . | ||
CMD ["./engine"] | ||
ENV PATH="/app:${PATH}" | ||
|
||
COPY --from=build /app/bin/mesg-cli . | ||
COPY --from=build /app/bin/mesg-daemon . | ||
|
||
CMD ["mesg-daemon", "start"] |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
FROM ubuntu:18.04 | ||
RUN apt-get update && \ | ||
apt-get install -y --no-install-recommends ca-certificates=20180409 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
COPY ./bin/engine . | ||
CMD [ "./engine" ] | ||
ARG from | ||
FROM $from | ||
|
||
COPY ./dev-chain/cli /root/.mesg-cli | ||
COPY ./dev-chain/validator /root/.mesg-node | ||
COPY ./scripts/dev-starter.sh . | ||
|
||
CMD ["bash", "dev-starter.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,87 @@ | ||
.PHONY: all build build-cmd-cosmos changelog check-version clean clean-build clean-docker dep dev dev-mon dev-start dev-stop docker-build docker-dev docker-publish docker-publish-dev docker-tools genesis lint protobuf test publish-cmds build-docker-cli build-docker-cli-dev | ||
.PHONY: build build-docker publish publish-docker-prod publish-docker-unstable test e2e dep lint build-tools protobuf changelog clean dev dev-mon | ||
|
||
version ?= local | ||
MAJOR_VERSION := $(shell echo $(version) | cut -d . -f 1) | ||
MINOR_VERSION := $(shell echo $(version) | cut -d . -f 1-2) | ||
PATCH_VERSION := $(version) | ||
|
||
all: clean lint build test e2e | ||
# Build | ||
|
||
check-version: | ||
ifndef version | ||
$(error version is undefined) | ||
endif | ||
build: dep | ||
./scripts/build-cli.sh "$(version)" | ||
|
||
docker-build: check-version | ||
build-docker: | ||
docker build \ | ||
--build-arg version=$(PATCH_VERSION) \ | ||
-t mesg/engine:$(MAJOR_VERSION) \ | ||
-t mesg/engine:$(MINOR_VERSION) \ | ||
-t mesg/engine:$(PATCH_VERSION) \ | ||
-t mesg/engine:latest \ | ||
--build-arg version=$(version) \ | ||
-t mesg/engine:$(version) \ | ||
. | ||
docker build \ | ||
-f ./Dockerfile.dev \ | ||
--build-arg from=mesg/engine:$(version) \ | ||
-t mesg/engine:$(version)-dev \ | ||
. | ||
|
||
docker-dev: dep | ||
./scripts/build-engine.sh | ||
|
||
docker-publish: docker-build | ||
docker push mesg/engine:$(MAJOR_VERSION) | ||
docker push mesg/engine:$(MINOR_VERSION) | ||
docker push mesg/engine:$(PATCH_VERSION) | ||
docker push mesg/engine:latest | ||
# Publish | ||
|
||
docker-publish-dev: check-version | ||
docker build -t mesg/engine:dev --build-arg version=$(version) . | ||
docker push mesg/engine:dev | ||
publish: build | ||
./scripts/publish-cli.sh "$(version)" "$(release-type)" | ||
|
||
docker-tools: | ||
docker build -t mesg/tools:local -f Dockerfile.tools . | ||
publish-docker-prod: build-docker | ||
docker tag mesg/engine:$(version) mesg/engine:$(MINOR_VERSION) | ||
docker tag mesg/engine:$(version) mesg/engine:$(MAJOR_VERSION) | ||
docker tag mesg/engine:$(version) mesg/engine:latest | ||
|
||
dev: docker-dev | ||
- ./scripts/dev.sh | ||
docker push mesg/engine:$(version) | ||
docker push mesg/engine:$(MINOR_VERSION) | ||
docker push mesg/engine:$(MAJOR_VERSION) | ||
docker push mesg/engine:latest | ||
|
||
dev-mon: docker-dev | ||
- ./scripts/dev.sh -m | ||
docker tag mesg/engine:$(version)-dev mesg/engine:$(MINOR_VERSION)-dev | ||
docker tag mesg/engine:$(version)-dev mesg/engine:$(MAJOR_VERSION)-dev | ||
docker tag mesg/engine:$(version)-dev mesg/engine:latest-dev | ||
|
||
dev-start: docker-dev | ||
./scripts/dev.sh -q | ||
docker push mesg/engine:$(version)-dev | ||
docker push mesg/engine:$(MINOR_VERSION)-dev | ||
docker push mesg/engine:$(MAJOR_VERSION)-dev | ||
docker push mesg/engine:latest-dev | ||
|
||
dev-stop: docker-dev | ||
./scripts/dev.sh -m stop | ||
publish-docker-unstable: build-docker | ||
docker tag mesg/engine:$(version) mesg/engine:unstable | ||
docker push mesg/engine:unstable | ||
|
||
dep: | ||
go mod download | ||
docker tag mesg/engine:$(version)-dev mesg/engine:unstable-dev | ||
docker push mesg/engine:unstable-dev | ||
|
||
build: check-version dep | ||
go build -mod=readonly -o ./bin/engine -ldflags="-X 'github.com/mesg-foundation/engine/version.Version=$(version)'" core/main.go | ||
# Test | ||
|
||
publish-cmds: check-version dep | ||
./scripts/publish-cmds.sh "$(version)" "$(release-type)" | ||
test: dep | ||
go test -short -mod=readonly -v -coverprofile=coverage.txt ./... | ||
|
||
build-cmd: dep | ||
go build -mod=readonly -o ./bin/mesg-cli ./cmd/mesg-cli/ | ||
go build -mod=readonly -o ./bin/mesg-daemon ./cmd/mesg-daemon/ | ||
e2e: build-docker | ||
./scripts/run-e2e.sh "$(version)" | ||
|
||
build-docker-cli: check-version | ||
docker build -t mesg/engine:cli -f ./Dockerfile.cli --build-arg version=$(version) . | ||
dev: build-docker | ||
./scripts/dev.sh "$(version)" | ||
|
||
build-docker-cli-dev: build-docker-cli | ||
docker build -t mesg/engine:cli-dev -f ./Dockerfile.cli.dev --build-arg from=mesg/engine:cli . | ||
dev-mon: build-docker | ||
./scripts/dev.sh "$(version)" "monitoring" | ||
|
||
e2e: build-docker-cli-dev | ||
./scripts/run-e2e.sh | ||
# MISC | ||
|
||
test: dep | ||
go test -short -mod=readonly -v -coverprofile=coverage.txt ./... | ||
dep: | ||
go mod download | ||
|
||
lint: | ||
golangci-lint run | ||
docker run --rm -v $(PWD):/app -w /app golangci/golangci-lint:v1.21 golangci-lint run | ||
|
||
protobuf: docker-tools | ||
build-tools: | ||
docker build -t mesg/tools:local -f Dockerfile.tools . | ||
|
||
protobuf: build-tools | ||
docker run --rm -v $(PWD):/project mesg/tools:local ./scripts/build-proto.sh | ||
|
||
changelog: | ||
./scripts/changelog.sh $(milestone) | ||
|
||
clean-build: | ||
clean: | ||
- rm -rf bin | ||
|
||
clean-docker: | ||
- docker image rm \ | ||
mesg/engine:$(version) \ | ||
mesg/engine:latest \ | ||
mesg/engine:local \ | ||
mesg/engine:dev 2>/dev/null | ||
|
||
clean: clean-build clean-docker | ||
|
||
genesis: | ||
go run internal/tools/gen-genesis/main.go --path $(path) --chain-id $(chain-id) --validators $(validators) | ||
- docker image rm $(docker images | grep 'mesg') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash -e | ||
|
||
if [[ -z "$1" ]]; then | ||
echo -e "version is not set, run:\n" | ||
echo "$0 vX.X.X" | ||
exit 1 | ||
fi | ||
|
||
LDFLAGS="-s -w -X 'github.com/cosmos/cosmos-sdk/version.Name=mesg' -X 'github.com/cosmos/cosmos-sdk/version.ServerName=mesg-daemon' -X 'github.com/cosmos/cosmos-sdk/version.ClientName=mesg-cli' -X 'github.com/cosmos/cosmos-sdk/version.Version=$1'" | ||
oss=(linux darwin) | ||
archs=(amd64 386) | ||
|
||
for os in ${oss[*]}; do | ||
for arch in ${archs[*]}; do | ||
echo "Building $os $arch..." | ||
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -mod=readonly -o "./bin/mesg-daemon-$os-$arch" -ldflags="$LDFLAGS" ./cmd/mesg-daemon/ | ||
CGO_ENABLED=0 GOOS=$os GOARCH=$arch go build -mod=readonly -o "./bin/mesg-cli-$os-$arch" -ldflags="$LDFLAGS" ./cmd/mesg-cli/ | ||
done | ||
done |
Oops, something went wrong.