mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-25 07:45:18 +00:00
add docker setup
This commit is contained in:
parent
bfd726a6e7
commit
666a034608
7
.dockerignore
Normal file
7
.dockerignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
vendor/
|
||||||
|
Dockerfile
|
||||||
|
deployment/
|
||||||
|
*.sublime-project
|
||||||
|
*.sublime-workspace
|
||||||
|
.kvd/
|
||||||
|
.kvcli/
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -17,3 +17,7 @@ vendor
|
|||||||
# Exclude text editor files
|
# Exclude text editor files
|
||||||
*.sublime-project
|
*.sublime-project
|
||||||
*.sublime-workspace
|
*.sublime-workspace
|
||||||
|
|
||||||
|
# Exclude chain data
|
||||||
|
.kvd/
|
||||||
|
.kvcli/
|
||||||
|
50
Dockerfile
50
Dockerfile
@ -1,37 +1,21 @@
|
|||||||
FROM alpine:edge
|
# Start with go container
|
||||||
|
FROM golang:alpine AS builder
|
||||||
|
WORKDIR /go/src/github.com/kava-labs/kava
|
||||||
|
|
||||||
# Set up dependencies
|
# Install go package manager
|
||||||
ENV PACKAGES go glide make git libc-dev bash
|
#RUN curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - doesn't work as alpine has no curl
|
||||||
|
RUN apk add --no-cache git && go get -u github.com/golang/dep/cmd/dep
|
||||||
|
|
||||||
# Set up GOPATH & PATH
|
# Install go packages (without updating Gopkg, as there is no source code to update from)(also with -v for verbose)
|
||||||
ENV GOPATH /root/go
|
ADD Gopkg.toml Gopkg.lock ./
|
||||||
ENV BASE_PATH $GOPATH/src/github.com/cosmos
|
RUN dep ensure --vendor-only -v
|
||||||
ENV REPO_PATH $BASE_PATH/cosmos-sdk
|
|
||||||
ENV WORKDIR /cosmos/
|
|
||||||
ENV PATH $GOPATH/bin:$PATH
|
|
||||||
|
|
||||||
# Link expected Go repo path
|
# Copy in app code and build
|
||||||
RUN mkdir -p $WORKDIR $GOPATH/pkg $ $GOPATH/bin $BASE_PATH
|
COPY . .
|
||||||
|
RUN go build ./cmd/kvd && go build ./cmd/kvcli
|
||||||
|
|
||||||
#Install apk dependencies
|
# Copy app binary over to small container.
|
||||||
RUN apk add --no-cache $PACKAGES
|
# Using alpine instad of scratch to aid in debugging and avoid complicated compile
|
||||||
|
FROM alpine
|
||||||
# Add build files
|
COPY --from=builder /go/src/github.com/kava-labs/kava/kvd /go/src/github.com/kava-labs/kava/kvcli /usr/bin/
|
||||||
COPY Gopkg.* Makefile $REPO_PATH/
|
CMD ["kvd", "start"]
|
||||||
COPY .git $REPO_PATH/.git
|
|
||||||
COPY tools $REPO_PATH/tools
|
|
||||||
|
|
||||||
# Intsall go packages
|
|
||||||
RUN cd $REPO_PATH && make get_tools && make get_vendor_deps
|
|
||||||
|
|
||||||
# Add source files
|
|
||||||
COPY . $REPO_PATH
|
|
||||||
|
|
||||||
# Build app
|
|
||||||
RUN cd $REPO_PATH && make all && make install
|
|
||||||
|
|
||||||
# remove packages
|
|
||||||
RUN apk del $PACKAGES
|
|
||||||
|
|
||||||
# Set default command
|
|
||||||
CMD ["kavad"]
|
|
||||||
|
21
docker-compose.yml
Normal file
21
docker-compose.yml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
kvd:
|
||||||
|
image: kava/kava
|
||||||
|
command: ["kvd", "start"]
|
||||||
|
ports:
|
||||||
|
- 46657:46657
|
||||||
|
volumes:
|
||||||
|
- ./.kvd:/root/.kvd
|
||||||
|
- ./.kvcli:/root/.kvcli
|
||||||
|
# Avoid printing out all the tendermint logs
|
||||||
|
logging:
|
||||||
|
driver: "none"
|
||||||
|
lcd:
|
||||||
|
image: kava/kava
|
||||||
|
command: "kvcli rest-server --chain-id test-kava-1 --node kvd:46657 --laddr tcp://0.0.0.0:1317"
|
||||||
|
ports:
|
||||||
|
- 1317:1317
|
||||||
|
volumes:
|
||||||
|
- ./.kvd:/root/.kvd
|
||||||
|
- ./.kvcli:/root/.kvcli
|
Loading…
Reference in New Issue
Block a user