Skip to content

Commit

Permalink
build(docker ): containersation changes
Browse files Browse the repository at this point in the history
Added Dockerfile and docker-compose.yml

 Signed-off-by: sedhu<[email protected]>
  • Loading branch information
sedhuait committed Oct 26, 2021
1 parent b0288e6 commit f88ba70
Show file tree
Hide file tree
Showing 11 changed files with 18,062 additions and 15,218 deletions.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
./node_modules
./dist
.git
.gitignore
node_modules
npm-debug.log
Dockerfile*
docker-compose*
README.md
LICENSE
.vscode
14 changes: 14 additions & 0 deletions erc20-swap/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
./node_modules
./dist
.git
.gitignore
node_modules
artifacts
build
cache
npm-debug.log
Dockerfile*
docker-compose*
README.md
LICENSE
.vscode
40 changes: 40 additions & 0 deletions erc20-swap/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@


# From Alpine 3.14 as the Base Image
FROM alpine:3.14

# Maintainer
LABEL maintainer = "[email protected]"

# Desc
LABEL description="VMware Blockchain Starter Kit - ERC20 Swap"

# Copy the sample applications
COPY . /workspace/erc20-swap
# COPY ./erc20-load-test-tool /workspace/erc20-load-test-tool



# Install Dependencies
RUN apk add --update nodejs=14.18.1-r0
RUN apk add --update npm=7.17.0-r0

# Run build Commands
WORKDIR /workspace/erc20-swap

RUN npm install
RUN npm run clean
# RUN npm run build
# RUN npm run deploy:concord
# RUN npm run start

# Expose Ports
EXPOSE 3000

# Enviroinment Variables
ENV VMBC_CHAIN_ID=5000
ENV VMBC_URL=http://host.docker.internal:8545

CMD ./run.sh

# docker build -f Dockerfile -t vmbc-erc20-swap-kit:1 .
22 changes: 21 additions & 1 deletion erc20-swap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,30 @@

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts



# Available Scripts

## Container Mode

### `./build.sh`
To build a docker image out of the erc20 swap example on a alpine linux

### `docker-compose -f docker-compose.yml up | down`
To bring up / down the container which will connect to host to VMBC instance

## Local Mode

In the project directory, you can run:

### `yarn install`
To install all the dependencies

### `yarn deploy:concord`
Deploys the smart contact in localhost:8545 VMBC Network.
Refer `hardhat.config.ts` for any config changes

### `yarn start`

Runs the app in the development mode.\
Expand Down
2 changes: 2 additions & 0 deletions erc20-swap/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker rmi vmbc-erc20-swap-kit:latest -f
docker build -f Dockerfile -t vmbc-erc20-swap-kit:latest .
13 changes: 13 additions & 0 deletions erc20-swap/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3.8"
services:

erc20-swap:
image: vmbc-erc20-swap-kit:latest
container_name: vmbc-erc20-swap-kit
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- VMBC_URL=http://host.docker.internal:8545
- VMBC_CHAIN_ID=5000
ports:
- 3000:3000
4 changes: 2 additions & 2 deletions erc20-swap/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ export default {
},
concord: {
//url: "http://10.72.228.91:8545",
url: "http://localhost:8545",
chainId: 5000,
url: process.env.VMBC_URL || "http://localhost:8545",
chainId: Number(process.env.VMBC_CHAIN_ID) || 5000,
gasPrice : 0,
from: '627306090abaB3A6e1400e9345bC60c78a8BEf57'
},
Expand Down
Loading

0 comments on commit f88ba70

Please sign in to comment.