New pipeline and Dockerfile

This commit is contained in:
Ruslan Gladov 2024-06-15 20:34:34 +03:00
parent 9d31aa9076
commit 0fd513eac2
8 changed files with 61 additions and 23 deletions

View file

@ -26,23 +26,25 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# - name: Set up Node.js
# uses: actions/setup-node@v4
# with:
# node-version: '20'
- name: Install dependencies
run: npm install --save-dev hardhat
# - name: Install dependencies
# run: npm install --save-dev hardhat
- name: Run local devnet
run: |
docker-compose up -d
run: docker-compose up -d
- name: Deploy contracts
run: |
cd /home/runner/work/go-ethereum/go-ethereum/hardhat
npm install --save-dev @nomicfoundation/hardhat-toolbox
npx hardhat ignition deploy ./ignition/modules/Lock.js
- name: Build a new image with Apollo contract
run: docker build -t hardhat-ignition .
# - name: Deploy contracts
# run: |
# cd /home/runner/work/go-ethereum/go-ethereum/hardhat
# npm install --save-dev @nomicfoundation/hardhat-toolbox
# npx hardhat ignition deploy ./ignition/modules/Lock.js
- name: Build and push Docker image
@ -52,6 +54,5 @@ jobs:
push: true
tags: e1018mc/limechain:deployed
- name: Tear down local devnet
run: |
docker-compose down
- name: Destroy local devnet
run: docker-compose down

View file

@ -1,6 +0,0 @@
require("@nomicfoundation/hardhat-toolbox");
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.24",
};

15
hardhat/Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM node:lts-alpine
RUN apk add --no-cache bash
WORKDIR /usr/app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8545
CMD ["npx", "hardhat", "ignition", "deploy", "/usr/app/ignition/modules/Apollo.js"]

View file

@ -0,0 +1,16 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
contract Rocket {
string public name;
string public status;
constructor(string memory _name) {
name = _name;
status = "ignition";
}
function launch() public {
status = "lift-off";
}
}

View file

@ -1,4 +1,5 @@
require("@nomicfoundation/hardhat-toolbox");
require("@nomicfoundation/hardhat-ignition-ethers");
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {

View file

@ -0,0 +1,9 @@
const { buildModule } = require("@nomicfoundation/hardhat-ignition/modules");
module.exports = buildModule("Apollo", (m) => {
const apollo = m.contract("Rocket", ["Saturn V"]);
m.call(apollo, "launch", []);
return { apollo };
});

View file

@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"devDependencies": {
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.4",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"hardhat": "^2.22.5"
}
@ -1333,7 +1334,6 @@
"integrity": "sha512-vY30V4b788GSziW/nOd0L/4IPw6mwpluahLs4+gPUUKWaHHGMA8OIeHaYpRRljM1i0M/Kg1yIozrDM/aeRebkg==",
"dev": true,
"license": "MIT",
"peer": true,
"peerDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.4",
"@nomicfoundation/hardhat-ignition": "^0.15.4",

View file

@ -5,10 +5,12 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.4",
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
"hardhat": "^2.22.5"
}