Skip to content

Commit

Permalink
chore(Dockerfile): use debug Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddyMc committed Oct 23, 2020
1 parent b9a21d1 commit f55b934
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 27 deletions.
33 changes: 8 additions & 25 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

23 changes: 23 additions & 0 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f55b934

Please sign in to comment.