diff --git a/Dockerfile b/Dockerfile index b599629..0357597 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,35 +1,18 @@ -# > docker build -t cosmos-cash . -# -# Server: -# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.poaapp:/root/.poaapp poaapp init test-chain -# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.poaapp:/root/.poaapp poaapp start -# -# Client: (Note the poaapp binary always looks at ~/.poaapp we can bind to different local storage) -# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.poaappcli:/root/.poaapp poaapp keys add foo -# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.poaappcli:/root/.poaapp poaapp keys list -FROM golang:alpine AS build-env +FROM golang:alpine RUN apk update -RUN apk add --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev python3 +RUN apk add --no-cache ca-certificates curl make git libc-dev bash gcc linux-headers eudev-dev python3 -WORKDIR /go/src/github.com/allinbits/cosmos-cash-poa +WORKDIR /root COPY . . -RUN make install - -## Final image -#FROM gcr.io/distroless/base:latest -FROM alpine:edge - -## Install ca-certificates -RUN apk add --update ca-certificates -WORKDIR /root +RUN go get github.com/go-delve/delve/cmd/dlv +RUN make install-debug -COPY --from=build-env /go/bin/poad /usr/bin/poad -COPY --from=build-env /go/bin/poacli /usr/bin/poacli +RUN cp ./poad /usr/bin +RUN cp ./poacli /usr/bin -EXPOSE 26656 26657 1317 9090 -CMD ["poad"] +EXPOSE 26656 26657 1317 9090 40000 diff --git a/Dockerfile.prod b/Dockerfile.prod new file mode 100644 index 0000000..f7f64c2 --- /dev/null +++ b/Dockerfile.prod @@ -0,0 +1,23 @@ +FROM golang:alpine AS build-env + +RUN apk update +RUN apk add --no-cache curl make git libc-dev bash gcc linux-headers eudev-dev python3 + +WORKDIR /go/src/github.com/allinbits/cosmos-cash-poa + +COPY . . + +RUN make install + +## Final image +#FROM gcr.io/distroless/base:latest +FROM alpine:edge + +RUN apk add --update ca-certificates +WORKDIR /root + +COPY --from=build-env /go/bin/poad /usr/bin/poad +COPY --from=build-env /go/bin/poacli /usr/bin/poacli + +EXPOSE 26656 26657 1317 9090 + diff --git a/Makefile b/Makefile index 61aa02d..23cf280 100644 --- a/Makefile +++ b/Makefile @@ -134,7 +134,7 @@ send-token: poacli tx send $(shell go run cmd/poacli/main.go keys show euro-token-issuer -a) $(shell go run cmd/poacli/main.go keys show validator -a) 50000000eurotoken --from euro-token-issuer -y --trust-node --chain-id cash send-token-back: - poacli tx send $(shell go run cmd/poacli/main.go keys show validator -a) $(shell go run cmd/poacli/main.go keys show euro-token-issuer -a) 50000000eurotoken --from euro-token-issuer -y --trust-node --chain-id cash + poacli tx send $(shell go run cmd/poacli/main.go keys show validator -a) $(shell go run cmd/poacli/main.go keys show euro-token-issuer -a) 10000000eurotoken --from euro-token-issuer -y --trust-node --chain-id cash mint-token: go run cmd/poacli/main.go tx issuer mint-token eurotoken 50000000 --trust-node --from euro-token-issuer --chain-id cash diff --git a/docker-compose.yml b/docker-compose.yml index c588e20..7035d26 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,7 +14,7 @@ services: volumes: - ./build/.poad:/root/.poad - ./build/validator:/root/validator - command: ["poad", "start"] + command: ["sh", "-c", "dlv --listen=:40000 --headless --accept-multiclient exec --continue ./poad -- start --home /root/.poad"] networks: localnet: ipv4_address: 192.16.10.2