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 }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Node.js # - name: Set up Node.js
uses: actions/setup-node@v4 # uses: actions/setup-node@v4
with: # with:
node-version: '20' # node-version: '20'
- name: Install dependencies # - name: Install dependencies
run: npm install --save-dev hardhat # run: npm install --save-dev hardhat
- name: Run local devnet - name: Run local devnet
run: | run: docker-compose up -d
docker-compose up -d
- name: Deploy contracts - name: Build a new image with Apollo contract
run: | run: docker build -t hardhat-ignition .
cd /home/runner/work/go-ethereum/go-ethereum/hardhat
npm install --save-dev @nomicfoundation/hardhat-toolbox # - name: Deploy contracts
npx hardhat ignition deploy ./ignition/modules/Lock.js # 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 - name: Build and push Docker image
@ -52,6 +54,5 @@ jobs:
push: true push: true
tags: e1018mc/limechain:deployed tags: e1018mc/limechain:deployed
- name: Tear down local devnet - name: Destroy local devnet
run: | run: docker-compose down
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-toolbox");
require("@nomicfoundation/hardhat-ignition-ethers");
/** @type import('hardhat/config').HardhatUserConfig */ /** @type import('hardhat/config').HardhatUserConfig */
module.exports = { 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", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@nomicfoundation/hardhat-ignition-ethers": "^0.15.4",
"@nomicfoundation/hardhat-toolbox": "^5.0.0", "@nomicfoundation/hardhat-toolbox": "^5.0.0",
"hardhat": "^2.22.5" "hardhat": "^2.22.5"
} }
@ -1333,7 +1334,6 @@
"integrity": "sha512-vY30V4b788GSziW/nOd0L/4IPw6mwpluahLs4+gPUUKWaHHGMA8OIeHaYpRRljM1i0M/Kg1yIozrDM/aeRebkg==", "integrity": "sha512-vY30V4b788GSziW/nOd0L/4IPw6mwpluahLs4+gPUUKWaHHGMA8OIeHaYpRRljM1i0M/Kg1yIozrDM/aeRebkg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"peerDependencies": { "peerDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.4", "@nomicfoundation/hardhat-ethers": "^3.0.4",
"@nomicfoundation/hardhat-ignition": "^0.15.4", "@nomicfoundation/hardhat-ignition": "^0.15.4",

View file

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