-
Notifications
You must be signed in to change notification settings - Fork 0
모니터링 및 구현 고도화 #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
모니터링 및 구현 고도화 #11
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Gradle | ||
| .gradle/ | ||
| build/ | ||
| gradle-app.setting | ||
| !gradle-wrapper.jar | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.iws | ||
| *.iml | ||
| *.ipr | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # Documentation | ||
| README.md | ||
| *.md | ||
|
|
||
| # Docker | ||
| Dockerfile* | ||
| docker-compose*.yml | ||
|
|
||
| # Monitoring | ||
| monitoring/ | ||
|
|
||
| # Test files | ||
| src/test/ | ||
|
|
||
| # Temporary files | ||
| *.tmp | ||
| *.log | ||
| *.pid | ||
| *.seed | ||
| *.pid.lock | ||
|
|
||
| # Node modules (if any) | ||
| node_modules/ | ||
|
|
||
| # Maven (if any) | ||
| target/ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,19 @@ | ||
| # Build stage | ||
| FROM gradle:8.3-jdk17-alpine AS build | ||
| WORKDIR /app | ||
| COPY build.gradle.kts settings.gradle.kts /app/ | ||
| COPY src /app/src | ||
| RUN gradle build --no-daemon | ||
| FROM gradle:8.3-jdk17 AS builder | ||
| WORKDIR /home/gradle/project | ||
| COPY . . | ||
| RUN gradle build --no-daemon -x test | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wildcard COPY may fail: two jars (boot + plain) commonly exist.
Apply: -RUN gradle build --no-daemon -x test
+RUN gradle bootJar --no-daemon -x test
@@
-COPY --from=builder /home/gradle/project/build/libs/*.jar app.jar
+COPY --from=builder /home/gradle/project/build/libs/app.jar app.jarAnd in build.gradle (outside this file): +tasks.named('jar') { enabled = false }
+tasks.named('bootJar') {
+ archiveFileName = 'app.jar'
+}Also applies to: 12-13 🤖 Prompt for AI Agents |
||
|
|
||
| # Runtime stage | ||
| FROM openjdk:17-slim | ||
| RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* | ||
|
Comment on lines
+8
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Harden runtime image: drop root and simplify JVM flags.
Apply: FROM openjdk:17-slim
-RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists* \
+ && useradd -m -u 10001 appuser
@@
-ENV JAVA_OPTS="-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0"
+ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0"
-CMD ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]
+USER appuser
+CMD ["sh", "-c", "java $JAVA_OPTS -jar app.jar"]Also applies to: 18-19 🤖 Prompt for AI Agents |
||
|
|
||
| # Package stage | ||
| FROM openjdk:17-jdk-slim | ||
| WORKDIR /app | ||
| COPY --from=build /app/build/libs/*.jar /app/app.jar | ||
| COPY --from=builder /home/gradle/project/build/libs/*.jar app.jar | ||
|
|
||
| EXPOSE 8080 | ||
| CMD ["java", "-jar", "/app/app.jar"] | ||
| HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ | ||
| CMD curl -f http://localhost:8080/actuator/health || exit 1 | ||
|
|
||
| ENV JAVA_OPTS="-XX:+UseContainerSupport -XX:MaxRAMPercentage=75.0" | ||
| CMD ["sh", "-c", "java $JAVA_OPTS -jar app.jar"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Exclude secrets from the Docker build context.
Prevent accidental leakage of env files/keys into image layers.
Apply:
📝 Committable suggestion
🤖 Prompt for AI Agents