Skip to content

Commit

Permalink
Merge pull request #101 from IPHUN1989/96-frontend-pipeline
Browse files Browse the repository at this point in the history
96 frontend pipeline
  • Loading branch information
IPHUN1989 authored Jun 23, 2024
2 parents 9ad38a7 + fd146b8 commit 3c3e3a1
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
3 changes: 1 addition & 2 deletions backend/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
pipeline {
agent {
docker {
image 'maven:latest'
image 'maven@sha256:7106ce47b5c226ee21bac386cb706ff9f3db7ac2f15e251e3aa491fcbfc30028'
args '-u root --privileged --net="jenkins" -v $HOME/.m2:/root/.m2'
}
}
environment {
REPOSITORY = 'iphun/'
DOCKERHUB_CREDENTIALS=credentials('dockerHub')
IMAGE_NAME = 'bytebattlers-backend'
SUBFOLDER = 'backend'
}
stages {
stage('validate') {
Expand Down
65 changes: 65 additions & 0 deletions frontend/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
pipeline {
agent {
docker {
image 'node:20.9.0-slim@sha256:fdf5490bb2e1aba61297901bbe55d39202a6d9f18913bfb4a37466f8b728a44e'
args '-u root --privileged --net="jenkins"'
}
}
environment {
REPOSITORY = 'iphun/'
DOCKERHUB_CREDENTIALS=credentials('dockerHub')
IMAGE_NAME = 'bytebattlers-frontend'
}

stages {
stage('Install Dependencies') {
steps {
catchError {
sh 'npm --prefix ./frontend/ install'
}
}
}
stage('ES Linter check') {
steps {
catchError {
sh 'npm --prefix ./frontend/ run lint'
}
}
}
stage('Building static files') {
steps {
catchError {
sh 'npm --prefix ./frontend/ run build'
}
}
}


stage('Building image') {
steps{
script {
sh 'docker build -f ./frontend/Dockerfile -t ${REPOSITORY}${IMAGE_NAME}:latest -t ${REPOSITORY}${IMAGE_NAME}:${BUILD_NUMBER} ./frontend' }
}
}

stage('Docker Login and Push') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
sh 'docker push ${REPOSITORY}${IMAGE_NAME}:${BUILD_NUMBER}'
sh 'docker push ${REPOSITORY}${IMAGE_NAME}:latest'
}
}

stage('Extended notification') {
steps {
emailext (
subject: '$DEFAULT_SUBJECT',
body: '$DEFAULT_CONTENT',
to: '$DEFAULT_RECIPIENTS',
recipientProviders: [ requestor() ]
)
}
}
}

}
2 changes: 1 addition & 1 deletion frontend/src/Pages/UserFavoritesSite.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function UserFavoritesSite() {
{user.favoriteBoardGamePublicIDS.length !== 0 ?
<Typography textAlign={"center"} style={{ fontWeight: "bold" }}>Your Favorite Boardgames:</Typography>
: <div style={{ textAlign: "center" }}>
<Typography textAlign={"center"} style={{ fontWeight: "bold" }}>You don't have any favorite Boardgames!</Typography>
<Typography textAlign={"center"} style={{ fontWeight: "bold" }}>You do not have any favorite Boardgames!</Typography>
<Button href="/games">Jump to the Games!</Button>
</div>
}
Expand Down

0 comments on commit 3c3e3a1

Please sign in to comment.