Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1ad9044
Update deployment.yml
FortressTechnologiesInc Feb 1, 2024
0b0266c
Create Jenkinsfile
FortressTechnologiesInc Feb 1, 2024
86c7e4e
Update Jenkinsfile
FortressTechnologiesInc Feb 1, 2024
08c0031
Update deployment.yml
FortressTechnologiesInc Feb 1, 2024
6ae08dc
Update deployment.yml
FortressTechnologiesInc Feb 1, 2024
d66ee15
Update Jenkinsfile
FortressTechnologiesInc Feb 1, 2024
2ebb177
Update Jenkinsfile
FortressTechnologiesInc Feb 1, 2024
5225dc3
Update Jenkinsfile
FortressTechnologiesInc Feb 1, 2024
ba6e9d4
Create netflz.yml
FortressTechnologiesInc Apr 3, 2024
6ef65b4
Create imagescan.yml
FortressTechnologiesInc Apr 3, 2024
e5f170b
Create Dockerfile1
FortressTechnologiesInc Apr 4, 2024
8fc664a
Update docker-image.yml
FortressTechnologiesInc Apr 4, 2024
3834b1b
Update trivy.yml
FortressTechnologiesInc Apr 4, 2024
b9bb8c7
Create Dockerfile2
FortressTechnologiesInc Apr 4, 2024
3a7d81b
Create netflz.yml
FortressTechnologiesInc Apr 4, 2024
fc12a7d
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
add2417
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
4aab52c
Delete .github/workflows/docker-image.yml
FortressTechnologiesInc Apr 4, 2024
dcca64c
Delete .github/workflows/trivy.yml
FortressTechnologiesInc Apr 4, 2024
f8e1f96
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
b2ce007
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
3f35655
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
a74b08c
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
79cd7f1
Create trivy.yml
FortressTechnologiesInc Apr 4, 2024
2088723
Update trivy.yml
FortressTechnologiesInc Apr 4, 2024
3eaa1e9
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
8903467
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
150d6b8
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
c409636
Update netflz.yml
FortressTechnologiesInc Apr 4, 2024
a235fcd
Update and rename trivy.yml to netflzapp.yml
FortressTechnologiesInc Apr 4, 2024
ac08332
Create sonar-project.properties
FortressTechnologiesInc Apr 5, 2024
619222f
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
574ba52
Delete .github/workflows/netflz.yml
FortressTechnologiesInc Apr 5, 2024
1512f57
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
9b87134
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
daed40b
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
794dd3a
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
fc430a3
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
d4b59e7
Update netflzapp.yml
FortressTechnologiesInc Apr 5, 2024
94afc75
Update netflzapp.yml
FortressTechnologiesInc Jul 24, 2024
962f137
Update netflzapp.yml
FortressTechnologiesInc Jul 24, 2024
b58a2ff
Update netflzapp.yml
FortressTechnologiesInc Jul 24, 2024
0b339d6
Update netflzapp.yml
FortressTechnologiesInc Jul 24, 2024
372afb8
Update deployment.yml
FortressTechnologiesInc Jul 24, 2024
84d79b7
Update deployment.yml
FortressTechnologiesInc Jul 24, 2024
f24e44f
Create deploy
FortressTechnologiesInc Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/netflzapp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Docker Build and Deploy

on:
push:
branches:
- main

jobs:
build:
name: Build and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2



- name: Docker build and push
run: |
docker build --build-arg TMDB_V3_API_KEY=36a50cd7bedc727a9c31ebf3d41fc568 -t iscanprint/netflzapp:3.0 . -f Dockerfile2
docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
docker push iscanprint/netflzapp:3.0
18 changes: 18 additions & 0 deletions Dockerfile1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:16.17.0-alpine as builder
WORKDIR /app
COPY ./package.json .
COPY ./yarn.lock .
RUN yarn cache clean && \
yarn --network-timeout 1000000
COPY . .
ARG TMDB_V3_API_KEY
ENV VITE_APP_TMDB_V3_API_KEY=${TMDB_V3_API_KEY}
ENV VITE_APP_API_ENDPOINT_URL="https://api.themoviedb.org/3"
RUN yarn build

FROM nginx:stable-alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/dist .
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
22 changes: 22 additions & 0 deletions Dockerfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:16.17.0-alpine as builder
WORKDIR /app
COPY ./package.json .
COPY ./yarn.lock .
RUN npm cache clean --force && \
yarn cache clean && \
yarn config delete proxy && \
yarn config delete https-proxy && \
yarn config delete registry && \
yarn --network-timeout 1000000
COPY . .
ARG TMDB_V3_API_KEY
ENV VITE_APP_TMDB_V3_API_KEY=${TMDB_V3_API_KEY}
ENV VITE_APP_API_ENDPOINT_URL="https://api.themoviedb.org/3"
RUN yarn build

FROM nginx:stable-alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
COPY --from=builder /app/dist .
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
98 changes: 98 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
pipeline{
agent any
tools{
jdk 'jdk'
nodejs 'nodejs'
}
environment {
SCANNER_HOME=tool 'scanner'
}
stages {
stage('1.0 clean workspace'){
steps{
cleanWs()
}
}
stage('2.0 Checkout from Git'){
steps{
git branch: 'main', url: 'https://github.com/FortressTechnologiesInc/netflzapp.git'
}
}
stage('3.0 OWASP Scan') {
steps {
dependencyCheck additionalArguments: '--scan ./', odcInstallation: 'DP'
dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
}
}

stage("4.0 Sonarqube Analysis") {
steps {
withSonarQubeEnv('sonar') {
sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=netflzapp -Dsonar.java.binaries=. -Dsonar.projectKey=netflzapp '''
}
}
}
stage('Quality Check') {
steps {
script {
waitForQualityGate abortPipeline: false, credentialsId: 'sonar'
}
}
}
stage("5.0 Trivy FS SCAN") {
steps {
sh "trivy fs ."
}
}
stage("6.0 Docker Build & Push"){
steps{
script{
withDockerRegistry(credentialsId: 'docker', toolName: 'docker'){
sh "docker build --build-arg TMDB_V3_API_KEY=36a50cd7bedc727a9c31ebf3d41fc568 -t netflzapp . -f /root/appnode/workspace/netflzapp/Dockerfile"
sh "docker tag netflzapp limkel/netflzapp "
sh "docker push limkel/netflzapp "
sh "trivy image limkel/netflzapp > trivyimage.txt"
sh "docker rmi -f limkel/netflzapp "
}
}
}
}
stage("7.0 TRIVY"){
steps{
sh "trivy image limkel/netflzapp > trivyimage.txt"
}
}

stage('8.0 Deploy to kubernets'){
steps{
script{
dir('Kubernetes') {
withKubeConfig(caCertificate: '', clusterName: '', contextName: '', credentialsId: 'spjt', namespace: 'netflzapp', restrictKubeConfigAccess: false, serverUrl: 'https://192.168.49.2:8443') {
sh 'kubectl apply -f /root/appnode/workspace/netflzapp/deployment.yml -n netflzapp'
sh 'kubectl get po -n netflzapp'
sh 'kubectl get svc -n netflzapp'
}
}
}
}
}
stage('9.0clean workspace'){
steps{
cleanWs()
}
}

}
post {
always {
emailext attachLog: true,
subject: "'${currentBuild.result}'",
body: "Project: ${env.JOB_NAME}<br/>" +
"Build Number: ${env.BUILD_NUMBER}<br/>" +
"URL: ${env.BUILD_URL}<br/>",
to: 'deniferdavies@gmail.com',
attachmentsPattern: 'trivyfs.txt,trivyimage.txt'
}
}

}
36 changes: 27 additions & 9 deletions deployment.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,39 @@
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: netflix-app
name: netflzapp
namespace: netflzapp
labels:
app: netflix-app
app: netflzapp
spec:
replicas: 2
replicas: 1
selector:
matchLabels:
app: netflix-app
app: netflzapp
template:
metadata:
labels:
app: netflix-app
app: netflzapp
spec:
containers:
- name: netflix-app
image: gajananbarure/my_netflixapp_image
ports:
- containerPort: 80
- name: netflzapp
image: iscanprint/netflzapp:3.0
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: netflzapp
namespace: netflzapp
labels:
app: netflzapp
spec:
type: LoadBalancer #NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30007
selector:
app: netflzapp
1 change: 1 addition & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sonar.projectKey=netflzapp
1 change: 1 addition & 0 deletions src/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@