Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
Add deployment to Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcc1212 committed Apr 5, 2024
1 parent 0f4cfe3 commit c47f272
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ pipeline {
tools {
nodejs "NodeJS"
}
environment {
SSH_KEY = credentials('nial-ssh-aws') // Credential ID for SSH private key
REMOTE_USER = 'ubuntu' // User to SSH into the EC2 instance
REMOTE_HOST = '13.49.230.240' // Public IP or hostname of your EC2 instance
REMOTE_DIR = '/var/www/html/react-app' // Directory on the EC2 instance to deploy the app
REACT_APP_BUILD_DIR = 'build' // Build directory of your React app
}
stages {
stage('Install') {
steps {
Expand Down Expand Up @@ -31,6 +38,20 @@ pipeline {
}
}
}
stage('build') {
steps {
dir ('next/news-aggregation') {
sh 'npm run build'
}
}
}
stage deploy {
steps {
dir ('next/news-aggregation') {
sh 'scp -i ${key} -r build/* root@newnewtitanium:/var/www/html'
}
}
}
stage('jest') {
steps {
dir ('next/news-aggregation') {
Expand Down

0 comments on commit c47f272

Please sign in to comment.