Skip to content

Commit

Permalink
Problem: (fix #48, #47)missing dockerfile and docker-compose (#49)
Browse files Browse the repository at this point in the history
Solution:
  1. add dockerfile and docker-compose
  2. fix ci comment trigger
  • Loading branch information
allthatjazzleo authored Sep 9, 2020
1 parent cf619ac commit a995fb0
Show file tree
Hide file tree
Showing 6 changed files with 144 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Dockerfile
**/*.md
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ on:
branches:
- master
- release/**
issue_comment:
types: [created, edited]

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
Expand Down Expand Up @@ -49,6 +52,7 @@ jobs:
test-sim-nondeterminism:
runs-on: ubuntu-latest
needs: [build, install-runsim]
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
Expand All @@ -72,6 +76,7 @@ jobs:
test-sim-import-export:
runs-on: ubuntu-latest
needs: [build, install-runsim]
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
Expand All @@ -95,6 +100,7 @@ jobs:
test-sim-after-import:
runs-on: ubuntu-latest
needs: [build, install-runsim]
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v3
Expand Down
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# OS
.DS_Store
*.swp
*.swo
*.swl
*.swm
*.swn
.vscode
.idea

# Build
build

# Testing
coverage.txt

# Others
frontend/node_modules
frontend/dist
frontend/.cache
build
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

# Simple usage with a mounted data directory:
# > docker build -t cryptocom/chain-main .
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.chainmaind:/chain-main/.chainmaind -v ~/.chainmaincli:/chain-main/.chainmaincli cryptocom/chain-main chain-maind init [moniker] [flags]
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.chainmaind:/chain-main/.chainmaind -v ~/.chainmaincli:/chain-main/.chainmaincli cryptocom/chain-main chain-maind start
FROM golang:alpine AS build-env

# Set up dependencies
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3

# Set working directory for the build
WORKDIR /go/src/github.com/crypto-com/chain-main

# Add source files
COPY . .

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES && \
make install

# Final image
FROM alpine:edge

ENV CHAIN_MAIN /chain-main

# Install ca-certificates
RUN apk add --update ca-certificates

RUN addgroup chain-main && \
adduser -S -G chain-main chain-main -h "$CHAIN_MAIN"

USER chain-main

WORKDIR $CHAIN_MAIN

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/chain-maind /usr/bin/chain-maind
COPY --from=build-env /go/bin/chain-maincli /usr/bin/chain-maincli

# Run chain-maind by default, omit entrypoint to ease using container with chain-maincli
CMD ["chain-maind"]
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,10 @@ test-sim-import-export:

test-sim-after-import:
@echo "Running application simulation-after-import. This may take several minutes..."
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 5 TestAppSimulationAfterImport
@$(BINDIR)/runsim -Jobs=4 -SimAppPkg=$(SIMAPP) 50 5 TestAppSimulationAfterImport

clean:
rm -rf $(OUTPUT)/

clean-docker-compose:
rm -rf .validator*
71 changes: 71 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
version: '3'

services:
chainmainnode0:
container_name: chainmainnode0
image: "cryptocom/chain-main"
ports:
- "26656-26657:26656-26657"
environment:
- ID=0
- LOG=${LOG:-chain-maind.log}
command: 'chain-maind start'
volumes:
- ./.validator0/.chainmaind:/chain-main/.chainmaind:Z
networks:
localnet:
ipv4_address: 192.168.10.2

chainmainnode1:
container_name: chainmainnode1
image: "cryptocom/chain-main"
ports:
- "26659-26660:26656-26657"
environment:
- ID=1
- LOG=${LOG:-chain-maind.log}
command: 'chain-maind start'
volumes:
- ./.validator1/.chainmaind:/chain-main/.chainmaind:Z
networks:
localnet:
ipv4_address: 192.168.10.3

chainmainnode2:
container_name: chainmainnode2
image: "cryptocom/chain-main"
environment:
- ID=2
- LOG=${LOG:-chain-maind.log}
command: 'chain-maind start'
ports:
- "26661-26662:26656-26657"
volumes:
- ./.validator2/.chainmaind:/chain-main/.chainmaind:Z
networks:
localnet:
ipv4_address: 192.168.10.4

chainmainnode3:
container_name: chainmainnode3
image: "cryptocom/chain-main"
environment:
- ID=3
- LOG=${LOG:-chain-maind.log}
command: 'chain-maind start'
ports:
- "26663-26664:26656-26657"
volumes:
- ./.validator3/.chainmaind:/chain-main/.chainmaind:Z
networks:
localnet:
ipv4_address: 192.168.10.5

networks:
localnet:
driver: bridge
ipam:
driver: default
config:
-
subnet: 192.168.10.0/16

0 comments on commit a995fb0

Please sign in to comment.