From af6fb933d5300febbadfc7d5e8d11dd285d2c11f Mon Sep 17 00:00:00 2001 From: SURI Date: Sun, 31 Mar 2024 00:57:15 +0900 Subject: [PATCH 1/9] =?UTF-8?q?CI=20=ED=8C=8C=EC=9D=B4=ED=94=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=EC=B6=95=20=EB=B2=84=EC=A0=84=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20.env=20=ED=8C=8C=EC=9D=BC=20dockerfile=20=ED=86=B5?= =?UTF-8?q?=ED=95=B4=20build=20jenkinsfile=20=ED=86=B5=ED=95=B4=20?= =?UTF-8?q?=EA=B9=83=ED=97=88=EB=B8=8C=20=ED=91=B8=EC=8B=9C=20->=20?= =?UTF-8?q?=EB=8F=84=EC=BB=A4=EB=9D=BC=EC=9D=B4=EC=A6=88=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 1 + .gitignore | 2 +- Dockerfile | 14 ++++++++++++++ Jenkinsfile | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 Dockerfile create mode 100644 Jenkinsfile diff --git a/.env b/.env new file mode 100644 index 0000000..ce01a60 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +BUILD_NUMBER=cloud-0.0.5 \ No newline at end of file diff --git a/.gitignore b/.gitignore index b718f91..ad65e57 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. -.env + .env.production # dependencies /node_modules diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ab7ba19 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM node:14 + +WORKDIR /usr/src/app + +COPY package*.json ./ +RUN npm install + +COPY . . + +RUN npm run build + +EXPOSE 3000 + +CMD ["npm", "start"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..ac978bd --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,33 @@ +def component = [ + Preprocess: false, + Hyper: false, + Train: false, + Test: false, + Bento: false +] +pipeline { + agent any + stages { + stage("Checkout") { + steps { + checkout scm + } + } + stage("Build") { + steps { + script { + docker.build('shinyenggwak/front') + } + } + } + stage("Tag and Push") { + steps { + script { + docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') + app.push("${env.BUILD_NUMBER}") + app.push("latest") + } + } + } + } +} \ No newline at end of file From f2785d18078380ff8d16904e69439fafe4e9233d Mon Sep 17 00:00:00 2001 From: SURI Date: Sun, 31 Mar 2024 01:14:57 +0900 Subject: [PATCH 2/9] =?UTF-8?q?CI=20=ED=8C=8C=EC=9D=B4=ED=94=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=EC=B6=95=20=EB=B2=84=EC=A0=84=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20.env=20=ED=8C=8C=EC=9D=BC=20dockerfile=20=ED=86=B5?= =?UTF-8?q?=ED=95=B4=20build=20jenkinsfile=20=ED=86=B5=ED=95=B4=20?= =?UTF-8?q?=EA=B9=83=ED=97=88=EB=B8=8C=20=ED=91=B8=EC=8B=9C=20->=20?= =?UTF-8?q?=EB=8F=84=EC=BB=A4=EB=9D=BC=EC=9D=B4=EC=A6=88=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ac978bd..c82a2e5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,18 +15,16 @@ pipeline { } stage("Build") { steps { - script { - docker.build('shinyenggwak/front') - } + + docker.build('shinyenggwak/front') } } stage("Tag and Push") { steps { - script { - docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') - app.push("${env.BUILD_NUMBER}") - app.push("latest") - } + docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') + app.push("${BUILD_DATE_FORMATTED, "yyyy:MM:dd"}-develop") + app.push("latest") + } } } From 23836fc5a2bb2dfea285f49af3564980ec9fdc1a Mon Sep 17 00:00:00 2001 From: SURI Date: Sun, 31 Mar 2024 01:16:11 +0900 Subject: [PATCH 3/9] =?UTF-8?q?CI=20=ED=8C=8C=EC=9D=B4=ED=94=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=EC=B6=95=20=EB=B2=84=EC=A0=84=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20.env=20=ED=8C=8C=EC=9D=BC=20dockerfile=20=ED=86=B5?= =?UTF-8?q?=ED=95=B4=20build=20jenkinsfile=20=ED=86=B5=ED=95=B4=20?= =?UTF-8?q?=EA=B9=83=ED=97=88=EB=B8=8C=20=ED=91=B8=EC=8B=9C=20->=20?= =?UTF-8?q?=EB=8F=84=EC=BB=A4=EB=9D=BC=EC=9D=B4=EC=A6=88=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index c82a2e5..b8d93b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -22,7 +22,7 @@ pipeline { stage("Tag and Push") { steps { docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') - app.push("${BUILD_DATE_FORMATTED, "yyyy:MM:dd"}-develop") + app.push("${BUILD_DATE_FORMATTED}-develop") app.push("latest") } From f7eb5bf18dcecc2d00f227c2f377dbadc79aaf00 Mon Sep 17 00:00:00 2001 From: SURI Date: Sun, 31 Mar 2024 01:18:11 +0900 Subject: [PATCH 4/9] =?UTF-8?q?CI=20=ED=8C=8C=EC=9D=B4=ED=94=84=EB=9D=BC?= =?UTF-8?q?=EC=9D=B8=20=EA=B5=AC=EC=B6=95=20=EB=B2=84=EC=A0=84=20=EA=B4=80?= =?UTF-8?q?=EB=A6=AC=20.env=20=ED=8C=8C=EC=9D=BC=20dockerfile=20=ED=86=B5?= =?UTF-8?q?=ED=95=B4=20build=20jenkinsfile=20=ED=86=B5=ED=95=B4=20?= =?UTF-8?q?=EA=B9=83=ED=97=88=EB=B8=8C=20=ED=91=B8=EC=8B=9C=20->=20?= =?UTF-8?q?=EB=8F=84=EC=BB=A4=EB=9D=BC=EC=9D=B4=EC=A6=88=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b8d93b9..082a6d3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,15 +15,18 @@ pipeline { } stage("Build") { steps { - - docker.build('shinyenggwak/front') + script { + docker.build('shinyenggwak/front') + } } } stage("Tag and Push") { steps { - docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') - app.push("${BUILD_DATE_FORMATTED}-develop") - app.push("latest") + script { + docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') + app.push("${BUILD_DATE_FORMATTED}-develop") + app.push("latest") + } } } From bee7fe5eb1dc9073238d123cfbc4d02f5545f8ed Mon Sep 17 00:00:00 2001 From: SURI Date: Mon, 22 Apr 2024 16:27:22 +0900 Subject: [PATCH 5/9] =?UTF-8?q?fix:=20=EB=8F=84=EC=BB=A4=EB=A7=90=EA=B3=A0?= =?UTF-8?q?=20=EC=B9=B4=EB=8B=88=EC=BD=94..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 84 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 082a6d3..2441394 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,29 +6,67 @@ def component = [ Bento: false ] pipeline { - agent any - stages { - stage("Checkout") { - steps { - checkout scm - } - } - stage("Build") { - steps { + agent { + kubernetes { + yaml """ + apiVersion: v1 + kind: Pod + metadata: + labels: + jenkins/agent-type: kaniko + spec: + containers: + - name: jnlp + image: jenkins/inbound-agent:latest + resources: + requests: + memory: "512Mi" + cpu: "500m" + limits: + memory: "1024Mi" + cpu: "1000m" + - name: kaniko + image: gcr.io/kaniko-project/executor:debug + command: + - /busybox/cat + tty: true + resources: + requests: + memory: "2048Mi" + cpu: "2000m" + limits: + memory: "4096Mi" + cpu: "4000m" + volumeMounts: + - name: docker-config + mountPath: /kaniko/.docker/ + volumes: + - name: docker-config + secret: + secretName: docker-config + """ + } + } + + environment { + DOCKERHUB_USERNAME = "shinyenggwak" + IMAGE_NAME = "jenkins-test" + } + + stage("Build Docker Image & Push to Docker Hub") { + steps { + container("kaniko") { script { - docker.build('shinyenggwak/front') - } - } - } - stage("Tag and Push") { - steps { - script { - docker.withRegistry('https://registry.hub.docker.com', 'docker-credentials') - app.push("${BUILD_DATE_FORMATTED}-develop") - app.push("latest") - } + def context = "./app" + def dockerfile = "./app/Dockerfile" + def image = "${DOCKERHUB_USERNAME}/${IMAGE_NAME}:latest" - } - } - } + sh "git clone https://github.com/moija-project/FrontEnd.git ./app" + sh "cd ./app && git checkout sy-development" + + sh "/kaniko/executor --context ${context} --dockerfile ${dockerfile} --destination ${image}" + } + } + } + } } \ No newline at end of file From f11b7ff4d3cdac880b5c410a7b2dc766234f475c Mon Sep 17 00:00:00 2001 From: SURI Date: Mon, 22 Apr 2024 16:32:31 +0900 Subject: [PATCH 6/9] =?UTF-8?q?fix:=20=EB=8F=84=EC=BB=A4=EB=A7=90=EA=B3=A0?= =?UTF-8?q?=20=EC=B9=B4=EB=8B=88=EC=BD=94..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jenkinsfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 2441394..69fbcda 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,6 +61,8 @@ pipeline { def dockerfile = "./app/Dockerfile" def image = "${DOCKERHUB_USERNAME}/${IMAGE_NAME}:latest" + sh 'apk add --no-cache git' + sh "git clone https://github.com/moija-project/FrontEnd.git ./app" sh "cd ./app && git checkout sy-development" From d19c9014022042bfed4d1ba240a1499cdfd68dae Mon Sep 17 00:00:00 2001 From: SURI <20202160@sungshin.ac.kr> Date: Mon, 27 May 2024 20:10:00 +0900 Subject: [PATCH 7/9] =?UTF-8?q?feat:=20=EB=B9=8C=EB=93=9C=20=EC=A4=91=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=EB=A1=9C=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index ab7ba19..92ae1b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,8 @@ WORKDIR /usr/src/app COPY package*.json ./ RUN npm install +RUN npm install --save-dev @babel/plugin-proposal-private-property-in-object + COPY . . RUN npm run build From 9223dc12bad8dc16e64766b9fc6d6854d6636cdc Mon Sep 17 00:00:00 2001 From: SURI <20202160@sungshin.ac.kr> Date: Mon, 27 May 2024 20:22:47 +0900 Subject: [PATCH 8/9] =?UTF-8?q?fix:=20=EC=9D=B4=EA=B1=B8=EA=B9=8C=EB=82=98?= =?UTF-8?q?=20build=20=EB=84=88=EB=AC=B4=20=EC=98=A4=EB=9E=98=EA=B1=B8?= =?UTF-8?q?=EB=A0=A4=EC=84=9C=20=EC=A7=80=EC=9B=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 92ae1b5..6e4ab83 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,6 @@ RUN npm install --save-dev @babel/plugin-proposal-private-property-in-object COPY . . -RUN npm run build EXPOSE 3000 From c65d6b39669c320972ab3f03b4db5c773ff20f26 Mon Sep 17 00:00:00 2001 From: SURI <20202160@sungshin.ac.kr> Date: Mon, 27 May 2024 22:25:00 +0900 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20=EC=9D=B4=EA=B1=B8=EA=B9=8C=EB=82=98?= =?UTF-8?q?=20build=20=EB=84=88=EB=AC=B4=20=EC=98=A4=EB=9E=98=EA=B1=B8?= =?UTF-8?q?=EB=A0=A4=EC=84=9C=20=EC=A7=80=EC=9B=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6e4ab83..df6e745 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,6 @@ WORKDIR /usr/src/app COPY package*.json ./ RUN npm install -RUN npm install --save-dev @babel/plugin-proposal-private-property-in-object COPY . .