Skip to content
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

ci 스크립트 수정 #14

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 18 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,23 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-

# 다른 이름의 Docker 파일 사용
- name: Build Docker Image
run: docker build -t app-dev -f Dockerfile-dev .
# 2) JDK 17 버전 설치, 다른 JDK 버전을 사용한다면 수정 필요
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# 3)권한 부여 >> 리눅스 명령어다
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash

# 4) .build시작 >> 리눅스 명령어다.
# 빌드와 테스트를 함께 실행
- name: Build and Test with Gradle
run: ./gradlew clean build
shell: bash

# 도커 컴포즈를 통한 컨테이너 실행 (개발환경 전용)(빌드 테스트 통과 목적)
- name: Install Docker Compose
Expand All @@ -49,7 +63,6 @@ jobs:
working-directory: ./
run: docker-compose -f docker-compose-dev.yml up -d


# nc -z : netcat 명령어로 포트 연결 확인
# 최대 30번60초(2초 × 30회) 반복하며 MySQL 포트(13306)의 연결 상태를 체크합니다.
- name: Wait For MySQL to be ready
Expand All @@ -59,23 +72,4 @@ jobs:
echo "Waiting for MySQL..."
sleep 2
done
echo "MySQL did not become ready in time!" && exit 1

# 2) JDK 17 버전 설치, 다른 JDK 버전을 사용한다면 수정 필요
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

# 3)권한 부여 >> 리눅스 명령어다
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash


# 4) .build시작 >> 리눅스 명령어다.
# 빌드와 테스트를 함께 실행
- name: Build and Test with Gradle
run: ./gradlew clean build
shell: bash
echo "MySQL did not become ready in time!" && exit 1
File renamed without changes.
15 changes: 15 additions & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@
version: '3.8'

services:
app:
build:
context: .
dockerfile: Dockerfile.dev
container_name: spring-app-dev
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=dev
depends_on:
- db
- redis
networks:
- spring-dev-network

# MySQL 데이터베이스 서비스 설정
db:
image: mysql:8.0.33
Expand Down
Loading