-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from yymin1022/dev/jenkins-docker-setup
[DEV] Project CI/CD 구성
- Loading branch information
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |