Skip to content

Commit

Permalink
Merge branch 'main' of github.com:db1group/sonar-metrics-collector
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandroHervis committed Oct 11, 2023
2 parents 18eeb56 + e020a34 commit 225c221
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 27 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,26 @@ name: CD-Sonar Metrics Collector
on:
workflow_dispatch:
push:
branches:
- main
branches:
- main

jobs:
build:
name: Deploy-ssh
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Install Node.js
uses: actions/setup-node@v2
- name: Executing remote ssh commands
uses: appleboy/[email protected]
with:
node-version: '18.x'

- name: NPM install and build
run: |
npm install
npm run build
- name: Deploy-ssh
run: |
ssh-keyscan -t rsa -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
ssh -i ${{ secrets.SSH_PRIVATE_KEY }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} '
host: ${{ secrets.SSH_HOST }}
port: ${{ secrets.SSH_PORT }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd db1-projects/sonar-metrics-collector/;
docker container stop sonar-metrics-collector || true;
docker rm sonar-metrics-collector || true;
docker container stop sonar-metrics-collector;
docker rm sonar-metrics-collector;
git pull origin main;
docker rmi sonar-metrics-collector || true;
docker rmi sonar-metrics-collector;
docker build -t sonar-metrics-collector .;
docker run -d -t -i -e npm run start:prod -p 5100:5100 --name sonar-metrics-collector sonar-metrics-collector;
docker run -d -t -i -p 5100:5100 --net metrics-collector --name sonar-metrics-collector sonar-metrics-collector:latest npm run start:prod
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ RUN npm install pm2 -g
RUN npm install

# Copia o código fonte
COPY .env.prod .env
## COPY .env.prod .env
COPY . .

# Compila o TypeScript
RUN npm run build

# Define a porta em que o servidor irá escutar
EXPOSE 3030
EXPOSE 5100

# Comando para iniciar o servidor
CMD ["pm2", "start" , "dist/main.js", "--no-daemon"]
CMD ["pm2", "start" , "dist/main.js", "--no-daemon"]
2 changes: 1 addition & 1 deletion ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
exec_mode: 'cluster',
env: {
NODE_ENV: 'production',
PORT: 3030,
PORT: 5100,
},
},
],
Expand Down

0 comments on commit 225c221

Please sign in to comment.