Skip to content

Commit

Permalink
Feature/ci
Browse files Browse the repository at this point in the history
* made a docker image

* ignore yarn

* get rid of .yarn from commit

* lock changed

* docker compose

* azure devops ci

Co-authored-by: Thomas McDonald <[email protected]>
  • Loading branch information
atodorov and notaturkey committed Nov 30, 2023
1 parent f6c04d4 commit 125c88b
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.yarn
node_modules
package-lock.json
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

env.docker.compose
node_modules
.yarn
dist
build
dist-ssr
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
27 changes: 19 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
FROM node:buster as BUILDER

FROM node:18
WORKDIR /app
COPY . .
RUN apt update && apt install -y git
RUN yarn install && yarn build
# RUN mkdir /root/.ssh
# ADD ./.ssh/ /root/.ssh
# RUN chown node:node /app package.json yarn.lock
# USER node
# RUN useradd nodeUser
# RUN su - nodeUser
# RUN mkdir ~/.ssh/
# RUN cd ~/.ssh && ssh-keygen -t rsa -N '' -f ~/.ssh/id_rsa

RUN npm install yarn --legacy-peer-deps

# --------------------------------------------------
FROM nginx
# RUN touch ~/.ssh/known_hosts
# RUN ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
# RUN eval $(ssh-agent)

COPY --from=BUILDER /app/build /usr/share/nginx/html
RUN git config --global url."https://github.com/".insteadOf [email protected]:
RUN git config --global url."https://".insteadOf ssh://git

EXPOSE 80
RUN yarn install
CMD ["yarn", "dev"]
EXPOSE 5173
41 changes: 41 additions & 0 deletions creditcoin-staking-dashboard-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
trigger:
batch: true
branches:
include:
- main
- dev
- release/*
- feature/*
- project/*

pr:
- master
- dev

pool:
vmImage: ubuntu-latest

jobs:
- job: 'BuildAndPush'
steps:
- pwsh: |
$branchtag=""
echo "$(Build.SourceBranch)"
if ("$(Build.SourceBranch)" -match ".*release/.*"){
$branchtag=$( "$(Build.SourceBranch)" -replace "refs/heads/", "")
$branchtag=$( $branchtag -replace "/", "--")
}
echo "branchtag: $branchtag"
echo "##vso[task.setvariable variable=releaseTag;]$branchtag"
- task: Docker@2
displayName: 'Build Docker Image'
inputs:
containerRegistry: 'substrate-relayer'
repository: 'gluwa/staking-dashboard'
command: 'buildAndPush'
Dockerfile: '**/Dockerfile'
tags: |
$(Build.BuildId)
latest
$(releaseTag)
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use root/example as user/password credentials
version: '3.1'

services:

dashboard:
build: .
restart: always
ports:
- 5173:5173

miner:
image: gluwa/creditcoin:latest
ports:
- ${PORT}:${PORT}
- ${RPC_PORT}:${RPC_PORT}
volumes:
- /Users/notaturkey/dev/miner/data:/data
command:
--validator
--name creditcoin-miner
--prometheus-external
--telemetry-url "wss://telemetry.polkadot.io/submit/ 0"
--bootnodes "/dns4/bootnode.creditcoin.network/tcp/30333/p2p/12D3KooWAEgDL126EUFxFfdQKiUhmx3BJPdszQHu9PsYsLCuavhb" "/dns4/bootnode2.creditcoin.network/tcp/30333/p2p/12D3KooWSQye3uN3bZQRRC4oZbpiAZXkP2o5UZh6S8pqyh24bF3k" "/dns4/bootnode3.creditcoin.network/tcp/30333/p2p/12D3KooWFrsEZ2aSfiigAxs6ir2kU6en4BewotyCXPhrJ7T1AzjN"
--public-addr "/dns4/${IP_ADDRESS}/tcp/${PORT}"
--chain mainnet
--mining-key ${KEY}
--base-path /data
--port ${PORT}
--unsafe-rpc-external
--rpc-port ${RPC_PORT}
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
"version": "1.1.0",
"type": "module",
"license": "GPL-3.0-only",
"private": false,
"scripts": {
"build": "tsc && vite build --base '/'",
"build:pages": "tsc && vite build --base '/polkadot-staking-dashboard/'",
"clear": "rm -rf node_modules build tsconfig.tsbuildinfo",
"deploy:pages": "yarn build:pages && gh-pages -d build",
"dev": "vite",
"dev": "vite --host",
"lint": "eslint . --fix && npx prettier --write . && npx prettier --write ./.scripts && node ./.scripts/localeOrderKeys.cjs",
"locale:order": "node ./.scripts/localeOrderKeys.cjs",
"locale:validate": "node ./.scripts/localeValidate.cjs",
Expand Down

0 comments on commit 125c88b

Please sign in to comment.