From c9d6982859dcf530a2530521dd4b57d117127616 Mon Sep 17 00:00:00 2001 From: yymin1022 Date: Tue, 4 Jul 2023 02:33:41 +0900 Subject: [PATCH 1/5] Added Dockerfile --- Dockerfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e69de29 From 421b2d80deee3f803700a264c31959f7460e5577 Mon Sep 17 00:00:00 2001 From: yymin1022 Date: Tue, 4 Jul 2023 02:44:21 +0900 Subject: [PATCH 2/5] Update Project : Added Standalone Build Option --- next.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/next.config.js b/next.config.js index a843cbe..248c251 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,7 @@ /** @type {import('next').NextConfig} */ const nextConfig = { reactStrictMode: true, + output: 'standalone', } module.exports = nextConfig From fbe99321e2bff4064ce83d5f9250a40d782a33d1 Mon Sep 17 00:00:00 2001 From: yymin1022 Date: Tue, 4 Jul 2023 02:53:06 +0900 Subject: [PATCH 3/5] Update Dockerfile --- Dockerfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Dockerfile b/Dockerfile index e69de29..fab64b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM node:18.16.1 AS builder + +WORKDIR /app + +COPY package*.json ./ +RUN npm install + +COPY . . +RUN npm run build + +FROM node:18.16.1 +WORKDIR /app + +ENV NODE_ENV production +ENV NEXT_TELEMETRY_DISABLED 1 + +RUN addgroup --system --gid 1001 nodejs +RUN adduser --system --uid 1001 nextjs + +COPY --from=builder /app/public ./public + +COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ +COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static + +USER nextjs + +EXPOSE 3000 +ENV PORT 3000 + +CMD ["node", "server.js"] \ No newline at end of file From 10762324f943c62ec37e5483c979424d1a7c2a20 Mon Sep 17 00:00:00 2001 From: yymin1022 Date: Tue, 4 Jul 2023 02:53:18 +0900 Subject: [PATCH 4/5] Added Jenkinsfile --- Jenkinsfile | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e69de29 From 4a7154de0caeab17713bfd904774870f4730d34b Mon Sep 17 00:00:00 2001 From: yymin1022 Date: Tue, 4 Jul 2023 02:54:05 +0900 Subject: [PATCH 5/5] Update Jenkinsfile --- Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index e69de29..5cd36b2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +pipeline { + agent any + + stages { + stage("Set Variable") { + steps { + script { + DOCKERHUB_CREDENTIAL = "dockerhub-yymin1022" + DOCKER_IMAGE_NAME = "military-license" + DOCKER_IMAGE_STORAGE = "yymin1022" + DOCKER_IMAGE_TAG = "release-1" + } + } + } + + stage("Build Docker Image") { + steps { + script { + image = docker.build("${DOCKER_IMAGE_STORAGE}/${DOCKER_IMAGE_NAME}") + } + } + } + + stage("Push Docker Image to Dockerhub") { + steps { + script { + docker.withRegistry("", DOCKERHUB_CREDENTIAL) { + image.push("$DOCKER_IMAGE_TAG") + image.push("latest") + } + } + } + } + } + +} \ No newline at end of file