mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-24 23:35:19 +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
|
||||
*.sublime-project
|
||||
*.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
|
||||
ENV PACKAGES go glide make git libc-dev bash
|
||||
# Install go package manager
|
||||
#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
|
||||
ENV GOPATH /root/go
|
||||
ENV BASE_PATH $GOPATH/src/github.com/cosmos
|
||||
ENV REPO_PATH $BASE_PATH/cosmos-sdk
|
||||
ENV WORKDIR /cosmos/
|
||||
ENV PATH $GOPATH/bin:$PATH
|
||||
# Install go packages (without updating Gopkg, as there is no source code to update from)(also with -v for verbose)
|
||||
ADD Gopkg.toml Gopkg.lock ./
|
||||
RUN dep ensure --vendor-only -v
|
||||
|
||||
# Link expected Go repo path
|
||||
RUN mkdir -p $WORKDIR $GOPATH/pkg $ $GOPATH/bin $BASE_PATH
|
||||
# Copy in app code and build
|
||||
COPY . .
|
||||
RUN go build ./cmd/kvd && go build ./cmd/kvcli
|
||||
|
||||
#Install apk dependencies
|
||||
RUN apk add --no-cache $PACKAGES
|
||||
|
||||
# Add build files
|
||||
COPY Gopkg.* Makefile $REPO_PATH/
|
||||
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"]
|
||||
# Copy app binary over to small container.
|
||||
# Using alpine instad of scratch to aid in debugging and avoid complicated compile
|
||||
FROM alpine
|
||||
COPY --from=builder /go/src/github.com/kava-labs/kava/kvd /go/src/github.com/kava-labs/kava/kvcli /usr/bin/
|
||||
CMD ["kvd", "start"]
|
||||
|
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