Added test environment
This commit is contained in:
16
Dockerfile-test
Normal file
16
Dockerfile-test
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
FROM node:20.13.1-alpine3.19 as build
|
||||||
|
WORKDIR /app/src
|
||||||
|
COPY package*.json ./
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add yarn
|
||||||
|
RUN yarn install --frozen-lockfile --no-progress
|
||||||
|
COPY . ./
|
||||||
|
RUN yarn build --configuration test
|
||||||
|
|
||||||
|
FROM node:20.13.1-alpine3.19
|
||||||
|
RUN addgroup -S k8s-group && adduser -S k8s-user -G k8s-group
|
||||||
|
USER root
|
||||||
|
WORKDIR /usr/app
|
||||||
|
COPY --from=build /app/src/dist/swiss-client/ ./
|
||||||
|
CMD node server/server.mjs
|
||||||
|
EXPOSE 4000
|
||||||
84
Jenkinsfile
vendored
84
Jenkinsfile
vendored
@@ -13,47 +13,47 @@ pipeline {
|
|||||||
// Defines the sequence of stages that will be executed
|
// Defines the sequence of stages that will be executed
|
||||||
stages {
|
stages {
|
||||||
// This stage checks out the source code from the SCM (Source Code Management) system
|
// This stage checks out the source code from the SCM (Source Code Management) system
|
||||||
// stage('Checkout') {
|
stage('Checkout') {
|
||||||
// steps {
|
steps {
|
||||||
// // This command checks out the source code from the SCM into the Jenkins workspace
|
// This command checks out the source code from the SCM into the Jenkins workspace
|
||||||
// checkout scm
|
checkout scm
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// stage('Build') {
|
stage('Build') {
|
||||||
// steps {
|
steps {
|
||||||
// sh 'yarn install --no-progress'
|
sh 'yarn install --no-progress'
|
||||||
// sh 'npm run ng build --prod'
|
sh 'npm run ng build --prod'
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// stage('Docker Build') {
|
stage('Docker Build') {
|
||||||
// steps {
|
steps {
|
||||||
// sh 'docker build -t upquark/swiss-client:latest -t upquark/swiss-client:${BUILD_NUMBER} .'
|
sh 'docker build -t upquark/swiss-client:latest -t upquark/swiss-client:${BUILD_NUMBER} .'
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// stage('Push the Docker Image to DockerHub') {
|
stage('Push the Docker Image to DockerHub') {
|
||||||
// steps {
|
steps {
|
||||||
// script {
|
script {
|
||||||
// withCredentials([string(credentialsId: 'c7783e4f-2f79-482f-885f-dfb39f8c02d3', variable: 'docker_hub')]) {
|
withCredentials([string(credentialsId: 'c7783e4f-2f79-482f-885f-dfb39f8c02d3', variable: 'docker_hub')]) {
|
||||||
// sh 'docker login -u upquark -p ${docker_hub}'
|
sh 'docker login -u upquark -p ${docker_hub}'
|
||||||
// }
|
}
|
||||||
// sh 'docker push upquark/swiss-client:latest'
|
sh 'docker push upquark/swiss-client:latest'
|
||||||
// sh 'docker push upquark/swiss-client:${BUILD_NUMBER}'
|
sh 'docker push upquark/swiss-client:${BUILD_NUMBER}'
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// stage('Deploy to Kubernetes') {
|
stage('Deploy to Kubernetes') {
|
||||||
// steps {
|
steps {
|
||||||
// script {
|
script {
|
||||||
// kubeconfig(credentialsId: 'k3s-kubeconfig') {
|
kubeconfig(credentialsId: 'k3s-kubeconfig') {
|
||||||
// sh 'cat k8s/deployment.yaml | sed "s/latest/$BUILD_NUMBER/g" | kubectl apply -n swiss -f -'
|
sh 'cat k8s/deployment.yaml | sed "s/latest/$BUILD_NUMBER/g" | kubectl apply -n swiss -f -'
|
||||||
// sh 'kubectl apply -f k8s/service.yaml -n swiss'
|
sh 'kubectl apply -f k8s/service.yaml -n swiss'
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
stage('Checkout test') {
|
stage('Checkout test') {
|
||||||
steps {
|
steps {
|
||||||
@@ -70,7 +70,7 @@ pipeline {
|
|||||||
|
|
||||||
stage('Docker Build test') {
|
stage('Docker Build test') {
|
||||||
steps {
|
steps {
|
||||||
sh 'docker build -t upquark/swiss-client-test:latest -t upquark/swiss-client-test:${BUILD_NUMBER} .'
|
sh 'docker build -t upquark/swiss-client-test:latest -t upquark/swiss-client-test:${BUILD_NUMBER} -f Dockerfile-test .'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user