Skip to content

Commit

Permalink
Merge pull request #19 from yymin1022/dev/jenkins-docker-setup
Browse files Browse the repository at this point in the history
[DEV] Project CI/CD 구성
  • Loading branch information
yymin1022 authored Jul 4, 2023
2 parents dc49abe + 4a7154d commit 6151209
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
36 changes: 36 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -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")
}
}
}
}
}

}
1 change: 1 addition & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
output: 'standalone',
}

module.exports = nextConfig

0 comments on commit 6151209

Please sign in to comment.