Skip to content

Commit 2f5e0cd

Browse files
authored
Feature/6 ci docker integration (#8)
* feat: DockerFile 추가 - DockerFile 추가와 초기 실행값 설정 * cicd: 도커 빌드및 푸시 자동화 설정 추가 - CI workflow에 도커 빌드와 Push 명령 추가 - 빌드 테스트 진행후 통과된다면 이미지를 도커허브에 추가 * fix: 도커 파일 파일명 수정 - 기존 DockerFile로 중간에 F 대문자로 인해 에러가 발생하여 파일명을 수정함 * Rename DockerfIle to Dockerfile * fix: 누락된 SonarCloud 관련 설정 추가 - 브랜치 생성중 누락된 workflow의 Sonar 관련 job 추가 * refactor: workflow 도커 로그인 방식 변경 - 보안강화를 위해 CI workflow에서의 도커 로그인 방식을 기존 패스워드 방식에서 엑세스 토큰 방식으로 변경 * refactor: workflow 도커 로그인 방식 변경 - 보안강화를 위해 CI workflow에서의 도커 로그인 방식을 기존 패스워드 방식에서 엑세스 토큰 방식으로 변경
1 parent 3670576 commit 2f5e0cd

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

.github/workflows/CI.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ jobs:
4141
restore-keys: |
4242
${{ runner.os }}-gradle-
4343
44+
- name: SonarCloud 패키지 캐싱
45+
uses: actions/cache@v4
46+
with:
47+
path: ~/.sonar/cache
48+
key: ${{ runner.os }}-sonar
49+
restore-keys: ${{ runner.os }}-sonar
50+
4451
- name: 빌드 권한 부여
4552
run: chmod +x ./gradlew
4653
shell: bash
@@ -72,9 +79,20 @@ jobs:
7279
title: updated_title,
7380
state: 'closed'
7481
})
82+
83+
84+
- name: 도커 허브 로그인
85+
run:
86+
echo "${{ secrets.DOCKER_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
7587

88+
- name: 도커 빌드및 Push
89+
run: |
90+
docker build -t 7zrv/somemore:${GITHUB_SHA::7} -t 7zrv/somemore:latest .
91+
docker push 7zrv/somemore:${GITHUB_SHA::7}
92+
docker push 7zrv/somemore:latest
93+
7694
77-
- name: Build and analyze
95+
- name: SonarCloud 빌드및 분석
7896
env:
7997
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
8098
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM openjdk:21-jdk
2+
3+
MAINTAINER seojin Yoon <[email protected]>
4+
5+
LABEL maintainer="Seojin Yoon <[email protected]>" \
6+
description="somemore API server Docker Image" \
7+
version="1.0"
8+
9+
COPY build/libs/*SNAPSHOT.jar app.jar
10+
11+
ENTRYPOINT ["java", "-jar", "/app.jar"]

0 commit comments

Comments
 (0)