-
Notifications
You must be signed in to change notification settings - Fork 0
Chore: Update CI/CD workflows #1
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
Changes from all 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,34 @@ | ||
| name: CD | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: [ "CI" ] | ||
| types: | ||
| - completed | ||
| branches: | ||
| - main | ||
|
|
||
| jobs: | ||
| deploy: | ||
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Login to DockerHub | ||
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | ||
|
|
||
| - name: Extract Docker image metadata | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: dungbik/flipnote-reaction | ||
| - name: Build and push Docker image | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.outputs.labels }} | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||||||||||||||||||||||
| name: CI | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Set up JDK 21 | ||||||||||||||||||||||||||
| uses: actions/setup-java@v4 | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| java-version: '21' | ||||||||||||||||||||||||||
| distribution: 'temurin' | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Setup Gradle | ||||||||||||||||||||||||||
| uses: gradle/actions/setup-gradle@v4 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Grant execute permission for gradlew | ||||||||||||||||||||||||||
| run: chmod +x gradlew | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Build with Gradle | ||||||||||||||||||||||||||
| run: ./gradlew build -x test | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Run tests | ||||||||||||||||||||||||||
| run: ./gradlew test | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| dependency-check: | ||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||
| - name: Checkout code | ||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Run dependency check | ||||||||||||||||||||||||||
| uses: dependency-check/Dependency-Check_Action@main | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| project: 'FlipNote-Reaction' | ||||||||||||||||||||||||||
| path: '.' | ||||||||||||||||||||||||||
| format: 'HTML' | ||||||||||||||||||||||||||
|
Comment on lines
+44
to
+49
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. 🧩 Analysis chain🌐 Web query:
💡 Result: GitHub Actions security best practices for version pinning (commit SHA vs tags)
Sources[1] GitHub Docs — Security hardening for GitHub Actions (docs.github.com) Citations:
🌐 Web query:
💡 Result:
You can view them here:
Sources: [1] https://github.com/dependency-check/Dependency-Check_Action/tags [2] https://github.com/dependency-check/Dependency-Check_Action/releases 🌐 Web query:
💡 Result: For
🏁 Script executed: #!/bin/bash
# Find the commit SHA for dependency-check/Dependency-Check_Action v1.1.0 release
# Using curl to query GitHub API
curl -s "https://api.github.com/repos/dependency-check/Dependency-Check_Action/releases/tags/1.1.0" | jq -r '.target_commitish' 2>/dev/null || echo "Check failed"Repository: FlipNoteTeam/FlipNote-Reaction Length of output: 78 dependency-check/Dependency-Check_Action을
해당 액션은 v1.1.0(최신 릴리스, 2021년 4월)이 존재합니다. 다음과 같이 릴리스 버전의 커밋 SHA로 고정하고 버전 주석을 추가하세요: - uses: dependency-check/Dependency-Check_Action@main
+ uses: dependency-check/Dependency-Check_Action@75ba02d6183445fe0761d26e836bde58b1560600 # v1.1.0이렇게 하면 공급망 위협을 줄이면서도 어떤 릴리스 버전을 사용하고 있는지 명확하게 유지할 수 있습니다. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| - name: Upload dependency check report | ||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||
| name: dependency-check-report | ||||||||||||||||||||||||||
| path: reports/ | ||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||||||||||||||||||
| FROM gradle:8-jdk21 AS build | ||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| COPY build.gradle.kts settings.gradle.kts ./ | ||||||||||||||||||||||
| COPY src ./src | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| RUN gradle bootJar --no-daemon | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| FROM eclipse-temurin:21-jre | ||||||||||||||||||||||
| WORKDIR /app | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ENV TZ=Asia/Seoul | ||||||||||||||||||||||
| RUN apt-get update \ | ||||||||||||||||||||||
| && apt-get install -y tzdata \ | ||||||||||||||||||||||
| && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \ | ||||||||||||||||||||||
| && echo $TZ > /etc/timezone \ | ||||||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||||||
|
Comment on lines
+13
to
+17
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.
불필요한 권장 패키지가 함께 설치되어 이미지 크기가 커지고 공격 표면이 넓어집니다. (Trivy DS-0029) 🛡️ 제안하는 수정 RUN apt-get update \
- && apt-get install -y tzdata \
+ && apt-get install -y --no-install-recommends tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*📝 Committable suggestion
Suggested change
🧰 Tools🪛 Trivy (0.69.1)[error] 13-17: 'apt-get' missing '--no-install-recommends' '--no-install-recommends' flag is missed: 'apt-get update && apt-get install -y tzdata && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && rm -rf /var/lib/apt/lists/*' Rule: DS-0029 (IaC/Dockerfile) 🤖 Prompt for AI Agents |
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| COPY --from=build /app/build/libs/reaction-0.0.1-SNAPSHOT.jar . | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| EXPOSE 8083 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ENTRYPOINT ["java", "-jar", "reaction-0.0.1-SNAPSHOT.jar"] | ||||||||||||||||||||||
|
Comment on lines
+9
to
+23
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. 컨테이너가 root 사용자로 실행됨 (보안 취약점)
🔒 제안하는 수정 - 비루트 사용자 추가 FROM eclipse-temurin:21-jre
WORKDIR /app
ENV TZ=Asia/Seoul
RUN apt-get update \
&& apt-get install -y --no-install-recommends tzdata \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& rm -rf /var/lib/apt/lists/*
+RUN addgroup --system appgroup && adduser --system --ingroup appgroup appuser
+
COPY --from=build /app/build/libs/reaction-0.0.1-SNAPSHOT.jar .
+USER appuser
+
EXPOSE 8083
ENTRYPOINT ["java", "-jar", "reaction-0.0.1-SNAPSHOT.jar"]🧰 Tools🪛 Trivy (0.69.1)[error] 13-17: 'apt-get' missing '--no-install-recommends' '--no-install-recommends' flag is missed: 'apt-get update && apt-get install -y tzdata && ln -sf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && rm -rf /var/lib/apt/lists/*' Rule: DS-0029 (IaC/Dockerfile) 🤖 Prompt for AI Agents
Comment on lines
+19
to
+23
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. 하드코딩된 SNAPSHOT JAR 이름으로 인한 버전 변경 시 빌드 실패
🐛 제안하는 수정-COPY --from=build /app/build/libs/reaction-0.0.1-SNAPSHOT.jar .
+COPY --from=build /app/build/libs/*.jar app.jar
EXPOSE 8083
-ENTRYPOINT ["java", "-jar", "reaction-0.0.1-SNAPSHOT.jar"]
+ENTRYPOINT ["java", "-jar", "app.jar"]🤖 Prompt for AI Agents |
||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.